Phpmysqli extension Library Application example
Example of php mysqli Extension Library:
- # Connecting to a database
- $ Link = mysqli_connect ("localhost", "root", "root ");
- # Selecting a database
- $ Link-> select_db ("rorely") or die ("cocould not find database ");
- # Querying databases
- $ Result = $ link-> query ("select * from test ");
- # Output the content of each record in the database table
- While ($ row = mysqli_fetch_object ($ result )){
- Echo $ row-> id. "". $ row-> name. "". $ row-> age. "". $ row-> sex. "". $ row-> address. "";
- }
- # Shut down the database
- Mysqli_close ($ link );
- ?>
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 |