Help me find a bug! The cell is created in the database, but the values are not recorded. How to fix?
<? if ($_COOKIE["TestCookie"] == NULL) { $value = 'что-то где-то'; setcookie("TestCookie", $value); ?> <div id="footer"> <form method="post" action=""> <input type="text" name="name"> <input type="text" name="price"> <input type="submit"> </form> </div> <? $db = mysql_connect("localhost", "root", ""); $ttt = mysql_select_db("testi3", $db); $q = mysql_query("SELECT * FROM trans"); $strSQL = "INSERT INTO trans(name, price) VALUES(name, price)"; mysql_query($strSQL) or die(mysql_error()); } else { echo "Вы можете добавить еще одно сообщение только завтра!"; } ?> Update
If you write
$strSQL = "INSERT INTO trans(name, price) VALUES({'$name'}, {'$price'})"; Gives an error message:
You have an error in your SQL syntax; check the syntax to use mySQL server, {''}) 'at line 1 or I misunderstand it?