我检索了一个查询并试图将id列存储在数组中。然后我检查两个阵列找到共同使用array_intersect FUNC ....如何将查询中检索到的值存储在一个php数组中
<?php
$a=array(10);
$connection = mysql_connect("localhost","root","");
$db=mysql_select_db("data",$connection);
$res=mysql_query("select * from usertable");
$i=0;
while($row=mysql_fetch_array($res))
{
$a[i]=$row["id"];
$i++;
}
echo $a[1];
$fb_usr_id =json_decode( $_POST['fb_user'], true);
$arr=array($fb_usr_id);
$result = array_intersect($arr, $a);
print_r($result);
?>
是其中我存储在检索到的值在阵列是正确...的方式??这段代码的 和输出是:
阵列()
这是完全正常的,你所采取的方式。这只意味着两个数组之间没有连接 – Neal 2011-06-14 15:16:21