Basic PHP and MySQL Tutorial This chapter describes how to use PHP to manipulate the MySQL database, including connection to the database, close the database connection sample Execute SQL statement get query result set, get SQL statement execution error information, get all the records in the result set, pagination display data, data Insert Database, Submit User Information HTML page, display data information PHP program, add delete link PHP program, delete database data can be said to be a complete basic tutorial php mysql.
Basic Tutorials for PHP tutorials and MySQL Tutorials
This chapter describes how to use PHP to manipulate the MySQL database tutorial, including connecting the database, closing the database connection example, executing the SQL statement to get the query result set, getting the SQL statement execution error information, getting all the records in the result set, paging the data, inserting the data into the database, Submit User Information HTML page, display data information PHP program, add delete link PHP program, delete database data can be said to be a complete basic tutorial php mysql.
Example of a 1.php connection database.
2.php close the database connection.
3.php executes the SQL statement.
4.php gets the SQL statement execution error information.
5.php gets the query result set.
6.php gets all the records in the result set.
7.php displays the data in the table with a PHP program.
8.php pagination displays data.
9.html HTML page that submits user information.
10.php data into the database.
11.php PHP program that displays data information.
12.php Add a PHP program to remove the link.
13.php Delete database data.
*/
Example of a 1.php connection database.
$host = ' localhost ';
$user _name = ' root ';
$password = ' admin ';
$conn = mysql_connect ($host, $user _name, $password);
if (! $conn)
{
Die (' Database connection failed:
'. Mysql_error ());
}
Echo ' database connection was successful! ';
2.php close the database connection.
$host = ' localhost ';
$user _name = ' root ';
$password = ' admin ';
$conn = mysql_connect ($host, $user _name, $password);
if (! $conn)
{
Die (' Database connection failed: '. mysql_error ());
}
Echo ' database connection was successful! ';
if (Mysql_close ($conn))
{
Echo '
........
';
Echo ' connection to the database has been successfully closed ';
}
1 2 3 4 5 6 7 8 9
http://www.bkjia.com/PHPjc/632050.html www.bkjia.com true http://www.bkjia.com/PHPjc/632050.html techarticle basic PHP and MySQL Tutorial This chapter describes how to use PHP to manipulate the MySQL database, including connection to the database, close the database connection sample Execute SQL statement get query result set, get SQL statement execution error ...