null array mysqli_fetch_assoc ( mysqli_result $result ) void mysqli_free_result ( mysqli_result $result )

w取最大db_id。 

 

 1 if($row=null){
 2     var_dump(123);
 3 }
 4 var_dump($row);
 5 
 6 if($rowb=array('ww','w123')){
 7     var_dump(234);
 8 }
 9 var_dump($rowb);
10 
11 $rowc=null;
12 if($rowc=null){
13     var_dump(345);
14 }
15 var_dump($rowc);

 

  NULL
  int(234)
  array(2) {
  [0]=>
  string(2) "ww"
  [1]=>
  string(4) "w123"
  }
  NULL

 

Returns an associative array that corresponds to the fetched row or NULL if there are no more rows.

 

 

 1 id  wint    wchar
 2 1    1001    1001www
 3 2    1002    1002www
 4 3    1003    1003www
 5 4    1004    1004www
 6 5    1005    1005www
 7 6    1006    1006www
 8 7    1007    1007www
 9 8    1008    1008www
10 9    1009    1009www
11 10    1010    1010www
12 11    1011    1011www
13 12    1012    1012www
14 13    1013    1013www
15 14    1014    1014www
16 15    1015    1015www
17 16    1016    1016www
18 UPDATE w1 SET wint=id+1000;
19 UPDATE w1 SET wchar=CONCAT(wint,'www');
20 DELETE FROM w1 WHERE id>16;

 

 1 $sql = 'SELECT * FROM w1 ';
 2 if ($result = mysqli_query($link, $sql)) {
 3     while ($row = mysqli_fetch_assoc($result)) {
 4         $w_id = $row['id'];
 5     }
 6    // mysqli_free_result($result);
 7 }
 8 var_dump($w_id);
 9 var_dump($row);
10 var_dump($result);

 

string(2) "16" NULL object(mysqli_result)#3 (5) { ["current_field"]=> int(0) ["field_count"]=> int(3) ["lengths"]=> NULL ["num_rows"]=> int(16) ["type"]=> int(0) }

 

 1 $sql = 'SELECT * FROM w1 ';
 2 if ($result = mysqli_query($link, $sql)) {
 3     while ($row = mysqli_fetch_assoc($result)) {
 4         $w_id = $row['id'];
 5     }
 6     mysqli_free_result($result);
 7 }
 8 var_dump($w_id);
 9 var_dump($row);
10 var_dump($result);

 

string(2) "16" NULL
Warning: var_dump() [function.var-dump]: Couldn't fetch mysqli_result
Warning: var_dump() [function.var-dump]: Couldn't fetch mysqli_result
Warning: var_dump() [function.var-dump]: Property access is not allowed yet
Warning: var_dump() [function.var-dump]: Couldn't fetch mysqli_result
Warning: var_dump() [function.var-dump]: Property access is not allowed yet
object(mysqli_result)#3 (5) { ["current_field"]=> NULL ["field_count"]=> NULL ["lengths"]=> NULL ["num_rows"]=> NULL ["type"]=> NULL }

 

posted @ 2017-01-19 14:55  papering  阅读(284)  评论(0编辑  收藏  举报