您好,我正在尝试使用 foreach 循环中的值更新我的 sql 数据库中的列,但我得到了..为 foreach() 提供的参数无效
foreach($ids as $id){
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://api.twitter.com/1/
users/lookup.json?user_id=".$id."");
curl_setopt($ch, CURLOPT_HEADER, 0);
// grab URL and pass it to the browser
$contents = curl_exec ($ch);
$ok=array();
$ok=json_decode($contents,true);
foreach($ok['results'] as $p){
$location=$p['location'];
$query=mysql_query("UPDATE tweets SET location=".$location."
WHERE from_user_id=".$id."");
if($query){
print'ok';
}else{print'sds';}
}
// close cURL resource, and free up system resources
curl_close($ch);
}
我究竟做错了什么?
欢呼人们!!!!