PHP query complete MySQL database code _ PHP Tutorial

Source: Internet
Author: User
PHP queries the complete MySQL database code. PHP queries the complete MySQL database code. when using this code, you must modify the user name and password in the connection statement .? Php $ linkmysql_connect (localhost, root, 123456) alert: ask PHP to query the complete MySQL database code. when using this code, change the user name and password in the connection statement.

$ Link = mysql_connect ('localhost', 'root', '000000') // the following prompt is displayed: change the user name and password first.
Or die ('could not connect: '. mysql_error ());
Mysql_select_db ('ruida ') or die ('could not select database ');

// Execute SQL query
$ Query = 'select * FROM product ';
$ Result = mysql_query ($ query) or die ('query failed: '. mysql_error ());

// Display the result in HTML
Echo"









\ N ";While ($ line = mysql_fetch_assoc ($ result )){Echo "\ t \ N ";Foreach ($ line as $ col_value ){Echo "\ t \ N ";}Echo "\ t \ N ";}Echo"
$ Col_value
\ N ";
// Release the result set
Mysql_free_result ($ result );
// Close the connection to Liehuo. Org
Mysql_close ($ link );
?>

The http://www.bkjia.com/PHPjc/364555.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/364555.htmlTechArticlePHP queries the complete code for the MySQL database, so be sure to modify the user name and password in the connection statement when using it. ? Php $ link = mysql_connect ('localhost', 'root', '000000') // alert: please...

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.