In mysqli, I represents improved. The general call process is: spanstylefont-size: 18px ;. span .. $ dbmysql_connect (...) ordie (connectingerror ...); connect to the database; $ queryselectnamefromuserslimit1; assemble the query string; $ resultmysqli_query ($ db, $ query) ordie (quer
In mysqli, I represents improved. The general call process is: span style = font-size: 18px ;. /span .. $ db = mysql_connect (...) or die (connecting error ...); // connect to the database; $ query = select name from users limit 1; // assemble the query string; $ result = mysqli_query ($ db, $ query) or die (quer
I in mysqli represents improved
General call process:
... $ Db = mysql_connect (...) or die ("connecting error... "); // connect to the database; $ query =" select name from users limit 1 "; // assemble the query string; $ result = mysqli_query ($ db, $ query) or die ("querying error... "); // execute the query; $ row = mysqli_fetch_array ($ result); // obtain the query result $ user_name = $ row ['name']; mysqli_close ($ db ); // close the connection ....
When developing a project, write a Mysqls encapsulation class, which encapsulates various methods, including construction and other basic methods. The call may be like this:
...$ms = new Mysqls;$sql ="select name from users limit 1";$data = $ms->getRow($sql);if(!$data){ $user_name = $data['name'];}...
Retrieve multiple entries
While ($ row = mysqli_fetch_array ($ result ))...
Foreach ($ data as $ m )...
In the command line, run the USE command before using the database (not required by phpMyAdmin)
DESCRIBE command in the command line
Avoid using * as much as possible and use fields instead.
Try to add limit to each statement
Do not use connection
Read more mysql optimization manual ......