```
$cuntRs = $this->db->query("SELECT count(*) as cunt from " . DB_PREFIX . "vendhq_product");
if($cuntRs->row["cunt"]==0) {
    foreach ($json["products"] as $dept){
        echo "<strong> Product ". $i++ ."</strong><br/>";

        $passval=$i;

        echo $dept["name"]."<br/>"; echo $dept["id"]."<br/>";

        $this->addVendHQproducts($dept,$passval);
    }
}

function addVendHQproducts($dept,$pro_id) {
     $this->db->query("INSERT INTO " . DB_PREFIX . "vendhq_product SET id = '" . $pro_id  . "', vendhq_id = '" . $dept["id"]. "', name = '" . $dept["name"]. "', description = '" . $dept["description"]. "',image = '" . $dept["image"] . "', image_large = '" . $dept["image"]. "', tag = '" . $dept["tags"]. "', price = '" . $dept["price"] . "', supplier_name = '" . $dept["supplier_name"] ."'");
}

```

?>
 **Output:**

```
Product 0
.........1
 ...........3..

Fatal error: Uncaught exception 'ErrorException' with message 'Error: 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 's server</p>',image = 'http://mohamedkaremullasha.vendhq.com/images/placeholder/' at line 1<br />Error No: 1064<br />INSERT INTO oc_vendhq_product SET id = '5', vendhq_id = 'bbeef777-9ac0-11e3-a0f5-b8ca3a64f8f4', name = 'TradeSender', description = '<p>trade sender iphone and ipod application to receive instant updates from ambibroker's server</p>',image = 'http://mohamedkaremullasha.vendhq.com/images/placeholder/product/no-image-white-thumb.png', image_large = 'http://mohamedkaremullasha.vendhq.com/images/placeholder/product/no-image-white-thumb.png', tag = 'share market, share updates', price = '100', supplier_name = 'Hibrise Tech -Suppliers'' in /Applications/XAMPP/xamppfiles/htdocs/mks/opencart-1.5.6.1/upload/system/database/mysqli.php:40 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/mks/opencart-1.5.6.1/uplo in 

```

/Applications/XAMPP/xamppfiles/htdocs/mks/opencart-1.5.6.1/upload/system/database/mysqli.php on line 40

//please let me know how to handle error exception in php