search
Homephp教程php手册php与mysql基础教程(1/9)

php与mysql基础教程(1/9)

Jun 13, 2016 am 09:57 AM
mysqlphpandintroduceuseBasehowoperateTutorial

php与mysql基础教程 本章介绍如何使用PHP操作MySQL数据库,包括连接数据库 ,关闭数据库连接 示例 执行SQL语句 获取查询结果集,获取SQL语句执行错误的信息,获取结果集中的所有记录,分页显示数据,数据插入数据库,提交用户信息的HTML页面,显示数据信息的PHP程序,添加删除链接的PHP程序,删除数据库数据可以说是一部完整的php mysql入门基础教程哦。

php教程与mysql教程基础教程
本章介绍如何使用php操作mysql数据库教程,包括连接数据库 ,关闭数据库连接 示例 执行sql语句 获取查询结果集,获取sql语句执行错误的信息,获取结果集中的所有记录,分页显示数据,数据插入数据库,提交用户信息的html页面,显示数据信息的php程序,添加删除链接的php程序,删除数据库数据可以说是一部完整的php mysql入门基础教程哦。

  1.php  连接数据库的示例。
  2.php  关闭数据库连接。
  3.php  执行sql语句。
  4.php  获取sql语句执行错误的信息。
  5.php  获取查询结果集。
  6.php  获取结果集中的所有记录。
  7.php  用php程序显示表中数据。
  8.php  分页显示数据。
  9.html  提交用户信息的html页面。
  10.php  数据插入数据库。
  11.php  显示数据信息的php程序。
  12.php  添加删除链接的php程序。
  13.php  删除数据库数据。

*/
 // 1.php  连接数据库的示例。

$host = 'localhost';
$user_name = 'root';
$password = 'admin';

$conn = mysql_connect($host,$user_name,$password);
if(!$conn)
{
    die('数据库连接失败:
'.mysql_error());
}
echo '数据库连接成功!';

 

// 2.php  关闭数据库连接。

$host = 'localhost';
$user_name = 'root';
$password = 'admin';

$conn = mysql_connect($host,$user_name,$password);
if(!$conn)
{
    die('数据库连接失败:'.mysql_error());
}
echo '数据库连接成功!';

if(mysql_close($conn))
{
    echo '
........
';
    echo '到数据库的连接已经成功关闭';
}

1 2 3 4 5 6 7 8 9

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.