2017-10-24 09:54
浏览 605


I have a list of IDs. For test this is about 20 items.

Now I want to make a loop and get extra data from another server. On this server I prepared a script - when you send it an item ID it will send back more details in JSON format.

while($row = mysql_fetch_array($result)){   
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "".$row['id_item']);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $ret = curl_exec ($ch);
    curl_close ($ch);

    $result = json_decode($ret, true);

    vecho "<br>";

When I go on I see result when I give an item id. But when I run script sometimes I have 1 result or 3 results and the message:

Warning: mysql_fetch_array() expects parameter 1 to be resource, array given in C:\wamp64\www\testfile.php on line 65

How should I do this?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题