iPixel Posted September 20, 2007 Share Posted September 20, 2007 I've done these simple form submission and insertions into DB countless times and now this one wont work and i dunno why lol ! i just give up and hope you guys have better eyes then i do ! Submission Form: <form action="add2queue.php" method="get"> <table width="300" border="0" cellpadding="0" cellspacing="0" align="center" style="border: 1px solid #336699; padding: 2px;"> <tr> <td colspan="2" align="center"><strong><font class="a2q_txt">Get In Queue</font></strong></td> </tr> <tr> <td><font class="a2q_txt">Model</font></td> <td><input type="text" id="model" name="model" class="a2q_box_txt" /></td> </tr> <tr> <td><font class="a2q_txt">Description</font></td> <td><input type="text" id="desc" name="desc" class="a2q_box_txt" /></td> </tr> <tr> <td><font class="a2q_txt">Vendor Name</font></td> <td><input type="text" id="vendor" name="vendor" class="a2q_box_txt" /></td> </tr> <tr> <td><font class="a2q_txt">Status</font></td> <td> <select id="status" name="status" class="a2q_box_txt"> <option value="Ordered">Ordered</option> <option value="In">In</option> </select> </td> </tr> <tr> <td><font class="a2q_txt">When Complete</font></td> <td> <select id="complete" name="complete" class="a2q_box_txt"> <option value="Return">Return</option> <option value="Keep">Keep</option> <option value="Give Away">Give Away</option> </select> </td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" id="submit" name="submit" value="Add My Product To Photography Queue" style="border: 1px solid #000000;" class="a2q_btn" /> </td> </tr> </table> </form> PHP Portion : <? //add2queue.php include('connect2db.php'); $model = $_GET['model']; echo $model . "<BR>"; $desc = $_GET['desc']; echo $desc . "<BR>"; $vendor = $_GET['vendor']; echo $vendor . "<BR>"; $status = $_GET['status']; echo $status . "<BR>"; $complete = $_GET['complete']; echo $complete . "<BR>"; $addquery = " INSERT INTO photoqueue (model, desc, vendor, status, complete, pm, timestamp, date) VALUES ('$model', '$desc', '$vendor', '$status', '$complete', '$_COOKIE[fname]', CURRENT_TIMESTAMP(), now()) "; echo $addquery . "<BR><BR>"; $doit = mysql_query($addquery) or die(mysql_error()); ?> The Bloody Error Msg : 987654 Testing Add Form Blah Blah Ordered Keep INSERT INTO photoqueue (model, desc, vendor, status, complete, pm, timestamp, date) VALUES ('987654', 'Testing Add Form', 'Blah Blah', 'Ordered', 'Keep', 'Piotr Turula', CURRENT_TIMESTAMP(), now()) 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 'desc, vendor, status, complete, pm, timestamp, date) VALUES ('987654', 'Tes' at line 1 Link to comment https://forums.phpfreaks.com/topic/70029-solved-i-give-up-whats-wrong/ Share on other sites More sharing options...
troy_mccormick Posted September 20, 2007 Share Posted September 20, 2007 DESC is a MySQL command and shouldn't be used as a field name. Try changing that field name to descrip and you should be good to go... Link to comment https://forums.phpfreaks.com/topic/70029-solved-i-give-up-whats-wrong/#findComment-351686 Share on other sites More sharing options...
Orio Posted September 20, 2007 Share Posted September 20, 2007 If the model column is "int" then the quotes might cause trouble, so remove the quotes around: VALUES ('$model', ... @troy I dont think this is the problem. Orio. Link to comment https://forums.phpfreaks.com/topic/70029-solved-i-give-up-whats-wrong/#findComment-351688 Share on other sites More sharing options...
troy_mccormick Posted September 20, 2007 Share Posted September 20, 2007 Hey Orio, I just tried inserting a numeric value into an INT field with quotes around it, and it worked fine. I really think it's the DESC field name. Unless you put ` around the field name, it would throw this error... Link to comment https://forums.phpfreaks.com/topic/70029-solved-i-give-up-whats-wrong/#findComment-351692 Share on other sites More sharing options...
iPixel Posted September 20, 2007 Author Share Posted September 20, 2007 DESC is a MySQL command and shouldn't be used as a field name. Try changing that field name to descrip and you should be good to go... Yep that was it .. thanks a bunch ! Yet again i feel weeeeeebit small lol ! thanx Orio as well. ~iPixel Link to comment https://forums.phpfreaks.com/topic/70029-solved-i-give-up-whats-wrong/#findComment-351693 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.