Dirty-Rockstar Posted August 16, 2007 Share Posted August 16, 2007 test1.php <?php include('sidebar.php'); print " <center><table> <tr> <td><form action=test.php method=post>Item name:</td> <td><input type=text name=itemname></td> </tr> <tr> <td>description: </td> <td><input type=text name=description></td> </tr> </table> <input type=submit value=Submit></form>"; print "</body></html>"; ?> test.php <? include('sidebar.php'); print "$_POST[itemname] <br /> $_POST[description]<br />"; $iteminsert1="INSERT INTO items (itemname, description) VALUES ( '{$_POST['itemname']}','{$_POST['description']}'"; $iteminsert2=mysql_query($iteminsert1) or die(mysql_error()); if ($iteminsert2) { print "Inserted"; }else{ Print "didnt work"; }; ?> Result: item weeeeeeeee You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 table fields: itemID (bigint20) (auto increment) itemname (text) description (text) I cant figure it out--thanks Quote Link to comment Share on other sites More sharing options...
lemmin Posted August 16, 2007 Share Posted August 16, 2007 You aren't closing the values() function. You need: "..VALUES ( '{$_POST['itemname']}','{$_POST['description']}')"; Quote Link to comment Share on other sites More sharing options...
Dirty-Rockstar Posted August 16, 2007 Author Share Posted August 16, 2007 If i told you i worked for about an hour on that thing you would probably spit your coffee on your monitor issue resolved Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.