开发者

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...................

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜