PHP and MySQL basic tutorial (1/9) _php Tutorial

Source: Internet
Author: User
Tags mysql tutorial php and mysql php mysql tutorial php mysql
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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.