Use a $variable inside a SQL string?

前端 未结 3 1394
傲寒
傲寒 2020-12-22 15:02

I would like to be able to select a category from a dropdown and depending on the category it will add it to whatever SQL table is it equal with.



        
3条回答
  •  庸人自扰
    2020-12-22 15:24

    You cannot use that type of variables, change last code to $sql="INSERT INTO $article (headline, content) VALUES ('" . $_POST['headline'] " . ', '" . $_POST['content'] . "')";

提交回复
热议问题