我已經能夠在查詢後創建數組。檢查數組中的值,並創建php語句
<?
$results = array();
while($row = mysql_fetch_assoc($result))
{
$results[] = $row;
}
?>
我現在已經從查詢結果如下數組:
array(2) {
[0]=>
array(1) {
["form_type"]=>
string(6) "VF-302"
}
[1]=>
array(1) {
["form_type"]=>
string(6) "VF-301"
}
}
如果,例如, 「VF-301」 值存在數組,你會一個PHP if語句是什麼?
<? //not working
if(in_array("VF-300", $results)){
echo "this value is in array";
} else {
echo "this value is not in array";
}
?>
[in \ _array()and multidimensional array](http://stackoverflow.com/questions/4128323/in-array-and-multidimensional-array) – kero 2015-03-24 21:40:41
如果您不需要其他行,你應該在查詢中這樣做。 – 2015-03-24 21:47:35