我已经能够在查询后创建数组。检查数组中的值,并创建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