PHP mysqli A number of query examples, interested friends can refer to the next. Mysqli_multi_query (mysqli link,string query) executes multiple queries consecutively, is a process-based msyqli_more_results (mysqli link) Primarily determines whether the returned result set has additional result sets Mysqli_next_result (mysqli link) Gets the next result set Example:
- #连接数据库
- $link =mysqli_connect ("localhost", "root", "root");
- #选择数据库
- $link->select_db ("rorely") or Die ("could not find database");
- #查询数据库
- if ($link->multi_query ("select * from Test;select name, age, sex,address from test") {
- do{
- $result = $link->store_result ();
- while ($row = $result->fetch_row ()) {
- echo "$row [0], $row [1], $row [2], $row [3]
";
- }
- if ($link->more_results ()) echo "**********
";
- }while ($link->next_result ());
- }
- $link->close ();
- ?>
Copy CodeThe results are as follows: 1,jane,26,female3,tome,21,male4,lily,25,female5,lucy,25,female6,jim,22,male7,jim,22,male**********jane,26 , female,wenming cun 123#tome,21,male,wenming cun 32#lily,25,female,wenming cun 2#lucy,25,female,wenming cun 2#Jim,22, Male,wenmin cun 45#jim,22,male,wenmin cun 45#li,22,female,wenming cun 23#hj,30,male,wenming cun 23#hj,30,male,wenming Cun 23# |