search

Home  >  Q&A  >  body text

There is an error in inserting post data into PHP code. Please give me some advice.

$mql="insert into user(uname,uage,passwd) value('"$uname"','"$uage"','"$passw"')" ;

Browser The feedback error is syntax error, unexpected T_VARIABLE. What is the error? What is the correct way to write it?

人间惆怅客人间惆怅客2039 days ago955

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2019-04-18 15:04:33

    Correct grammar:

    $mql = "INSERT INTO `user` (`uname`, `uage`, `passwd`) VALUES ('{$uname}', {$uage}, '{$passwd}')";

    or:

    $mql = "INSERT INTO `user` SET `uname` = '{$uname}',  `uage` = {$uage}, `passwd` = '{$passwd}'";

    reply
    0
  • Cancelreply