Operate data in the database in PHP (add, delete, modify, query)

Source: Internet
Author: User

<? Php <br/> // ensure that the PHP environment is created on the local machine and the database is created. "localhost" is the server address; "," root ", "" indicates the login username and password. "@" means blocking error. <br/> $ link = @ mysql_connect ("localhost", "root ",""); <br/> If (! $ Link) {die ("error") ;}< br/>/* The die () function means to send the strings in brackets to the browser and interrupt the PHP Program (SCRIPT ). The parameters in the brackets are the strings to be sent. */<Br/> // select the database named test on the server. <br/> $ db_selected = mysql_select_db ("test", $ link ); <br/> // print the data if the link is successful. <br/> if ($ db_selected) {<br/> echo "the database is selected successfully. "; <br/>}< br/>/* defines the variable q." select * from ABC "is an SQL statement, reads data from Table ABC */<br/> $ q = "select * from ABC"; <br/>?>

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.