Below is my code but I am getting an error at where clause
<?php
// include db connect class
require_once __DIR__ . '/db_connect.php';
// connecting to db
$db = new DB_CONNECT();
$response = array();
$dom = new DOMDocument();
$dom->loadHTMLFile("http://www.pizzahut.com.pk/deals.html");
//echo $dom->saveHTML();
$table = $dom->getElementsByTagName('td');
for($i = 30; $i < 35; $i++ ){
$deal = $table->item($i)->nodeValue;
echo $deal;
}
$id = 1813660169;
$result = mysql_query("INSERT INTO cafes(deal)
VALUES('$deal') WHERE `id` = " .$id) or die(mysql_error());
echo mysql_num_rows($result);
if ($result) {
// successfully inserted into database
$response["success"] = 1;
$response["message"] = "Place successfully created.";
// echoing JSON response
echo json_encode($response);
} else {
// failed to insert row
$response["success"] = 0;
$response["message"] = " ID already inserted";
// echoing JSON response
echo json_encode($response);
}
?>
Error is "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id
= 1813660169' at line 2"
Help needed