0

I am using the PHP API to get count information of images with their URL from other hosts updated to my database.

How can I fix the following error:

PHP Notice:  Undefined variable: c in /var/www/xxx_api.php on line 40
It failed to send query? SQL:UPDATE items SET count =   WHERE url="http://xx/img/beauty.jpg"

Line 40 is here:

   $sql = 'UPDATE items SET count = '.$c.'  WHERE url ="'.$p.'"';

This is the full code:

   while ($row = mysql_fetch_assoc($result)) {

    $p = $row["url"];

    $c = file_get_contents('http://xxxxx.jp/app/api/count?`
url='.rawurlencode($p));

    $sql = 'UPDATE items SET count = '.$c.'  WHERE url ="'.$p.'"';

    $result = mysql_query($sql, $link) or die("It failed to send query?<br `
/>SQL:".$sql);

}
CodeMouse92
  • 6,840
  • 14
  • 73
  • 130
2015
  • 11
  • 4

0 Answers0