1.php An example of connecting to a database.
2.php closes the database connection.
3.php executes the SQL statement.
4.php gets the information about the SQL statement execution error.
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 using a PHP program.
8.php pagination to display the data.
9.html HTML page that submits user information.
10.php data into the database.
11.php a PHP program that displays data information.
12.php Add a Delete link to the PHP program.
13.php Delete database data.
*/
1.php An example of connecting to a database.
The code is as follows |
Copy Code |
$host = ' localhost '; $user _name = ' root '; $password = ' admin '; $conn = mysql_connect ($host, $user _name, $password); if (! $conn) { Die (' Database connection failed:<br/> '. mysql_error ()); } Echo ' Database connection successful! '; |
2.php closes the database connection.
The code is as follows |
Copy Code |
$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 successful! '; if (Mysql_close ($conn)) { Echo ' <br/>........<br/> '; echo ' connection to database has been successfully closed '; } |
Home 1 2 3 4 5 6 7 8 9
last