Why is this simple SQL and PHP thing not working?
This is the code -
if(empty($errors))
{
mysqli_select_db($connect,"users");
$i = "insert into people (serial,name,price,desc) values ('','$name','$price','$desc')";
$qs = mysqli_query($connect,$i);
if($qs)
{
开发者_Python百科 echo "Awesome";
}
else
{
echo "geez";
}
}
it is always displaying geez.
One problem is that desc
is a reserved word so you must use backticks when using it as a column name:
INSERT INTO people (serial, name, price, `desc`) VALUES ...
echo mysqli_error
and you go...................
精彩评论