$cart = array(
"data" => array(
array(
"id" => 1,
"name" => "Product #1",
"description" => "Product Description",
"price"=>"50"
),
array(
"id" => 2,
"name" => "Product #2",
"description" => "Product Description",
"price"=>"150"
),
)
);
$ser=mysql_escape_string(serialize($cart));
function post_db($data){
$insert = ' insert ';
$into = ' into ';
$table = ' "data"("product_id", "name", "description", "price") ';
$value = ' VALUES (NULL,"data",'.$data.',100) ';
$query = $insert.$into.$table.$value;
}
post_db($ser);
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 '"data"("product_id", "name", "description", "price") VALUES (NULL,"data","$data' at line 1
$insert = ' insert ';
$into = ' into ';
mysql_escape_string