Pre-processing technology for MYSQL operations in php (2) database dql query statement _ PHP Tutorial

Source: Internet
Author: User
Preprocessing technology for MYSQL operations in php (2) database dql query statements. Preprocessing technology for MYSQL operations in php (2) database dql query statement connect_error) {die ($ mysqli-connect_error);} create pre-compiled object $ sqlselectid, name, age, QQ from table name w php pre-processing technology for MYSQL operations (2) database dql query statements
 Connect_error) {die ($ mysqli-> connect_error);} // create a pre-compiled object $ SQL = "select id, name, age, qq from table name where id
 Prepare ($ SQL); // bind the parameter $ id = 10; //? Value assignment. "ssi" refers to string, string, int. The data type and sequence are one-to-one correspondence. // bind_param () the number of parameters here is variable. $ Mysqli_compile-> bind_param ("I", $ id); // bind the result set. here we use the reference parameter passing method $ mysqli_compile-> bind_result ($ name, $ age, $ qq); // execute the statement $ res = $ mysqli_compile-> execute (); // Print the cause of failure if (! $ Res) {die ("cause of failure = ". $ mysqli_compile-error);} // retrieves the binding result value while ($ mysqli_compile-> fetch () {echo "-- $ id -- $ name -- $ age -- $ qq ";} // If you want to obtain other results, you can bind the parameter again to obtain the result, but you do not need to bind the result set // release the result set $ mysqli_compile-> free_result (); // Close the resource, remove the database pre-compiled command $ mysqli_compile-> close (); // close the linked resource $ mysqli-> close ();?>

Explain (2) database dql query statement connect_error) {die ($ mysqli-> connect_error);} // create a pre-compiled object $ SQL = "select id, name, age, qq from table name w...

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.