I just paste the data from the form using PHP into the MYSQL table, but I get an unusual error. My code
$q1="insert into product (category,image,name,desc) values ('$cat','$pname','$name','$desc')";
$res1=$con->query($q1);
if($res1)
{
some logic;
}
else
{
echo "error";
}
I unusually get the else part executed, even if the code is sytactically correct.i checked and checked the values of all the PHP variables. I use the OOP PHP style to connect to the database. Also, when executing a query in PHPmyadmin using random values too, I get the following error:
SQL query:
INSERT INTO Product( category, image, name, DESC )
VALUES (
'dsdsd', 'sddsd', 'sd', 'it is a nice'
)
MySQL said: Documentation
VALUES
('dsdsd','sddsd','sd','it is a nice')' at line 1
Ankur source
share