Home > database >  Mysql query problem
Mysql query problem

Time:03-13

Bosses, you have a question about the problem of query, specific I also say not clear, please see the following code:
 
//code a
$data=https://bbs.csdn.net/topics/array (a, b, c, d);//the array may have 1000 data
for($i=0; $iWhere $SQL="select * from XXX yyy=". The data [I];
$list=query ($SQL);
If (mysqli_num_rows ($list) & gt; 0 {
.//here to complete the task
}
}



 
//code 2
$data=https://bbs.csdn.net/topics/array (a, b, c, d);//the array may have 1000 data
$SQL="select * from XXX";
$list=query ($SQL);
$mem=array ();
Foreth ($list as $row) {
$mem []=$row;
}

for($i=0; $iFor ($j=0; $j=count ($mem); {$j++)
If ($mem [$j] [" yyy "]==$data [$I]) {
.//here to complete the task
}
}
}

Excuse me, these two code, which is better, why
  • Related