Phpmysqli extension Library Application example

Source: Internet
Author: User
Phpmysqli extension Library Application example

Example of php mysqli Extension Library:

  1. # Connecting to a database
  2. $ Link = mysqli_connect ("localhost", "root", "root ");
  3. # Selecting a database
  4. $ Link-> select_db ("rorely") or die ("cocould not find database ");
  5. # Querying databases
  6. $ Result = $ link-> query ("select * from test ");
  7. # Output the content of each record in the database table
  8. While ($ row = mysqli_fetch_object ($ result )){
  9. Echo $ row-> id. "". $ row-> name. "". $ row-> age. "". $ row-> sex. "". $ row-> address. "";
  10. }
  11. # Shut down the database
  12. Mysqli_close ($ link );
  13. ?>

Result: 1 Jane 26 female wenming cun 123 #3 Tome 21 male wenming cun 32 #4 Lily 25 female wenming cun 2 #5 Lucy 25 female wenming cun 2 #6 Jim 22 male wenmin cun 45 #7 Jim 22 male wenmin cun 45 #

Articles you may be interested in: how to add Extension Library for php in linux: how to add Extension Library for PHP: how to add Extension Library for CURL two methods php mysqli Extension Library preprocessing two examples php mysqli Extension Library operation mysql example

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.