aebstract Posted September 17, 2008 Share Posted September 17, 2008 if (!isset($var1)) { $content .= " <a href=\"/prices/add/\">Add New Part</a> "; } else { if ($var1 == add) { if(isset($_POST['submit'])) { $machine = $_POST['machine']; $partnum = $_POST['partnum']; $partname = $_POST['partname']; $description = $_POST['description']; $cnc = $_POST['cnc']; $dwg = $_POST['dwg']; $date = date('F j, Y'); $price = N/A; mysql_connect("localhost","berryequipment","gU8Kso8Y") or die(mysql_error()); mysql_select_db("berryequipment_net_db"); $query = MYSQL_QUERY("INSERT INTO part_pricing (date_entered, price, machine, partnum, partname, description, cnc, dwg)". "VALUES ('$date', '$price', '$machine', '$partnum', '$partname', '$description', '$cnc', '$dwg')"); header("Location: /prices/"); } $content .= " <form action=\"/prices/add/\" method=\"post\"> Machine: <input type=\"text\" size=\"15\" name=\"machine\" value=\"\" /> <br /> Part #: <input type=\"text\" size=\"15\" name=\"partnum\" value=\"\" /> <br /> Part Name: <input type=\"text\" size=\"15\" name=\"partname\" value=\"\" /> <br /> Description: <input type=\"text\" size=\"15\" name=\"description\" value=\"\" /> <br /> CNC #: <input type=\"text\" size=\"15\" name=\"cnc\" value=\"\" /> <br /> DWG #: <input type=\"text\" size=\"15\" name=\"dwg\" value=\"\" /> <br /> <input type=\"submit\" name=\"submit\" value=\"Add Part\" /> </form> "; } For some reason my information will not insert in to my database and I am not sure why, hopefully someone can see an issue here and help out. Thanks! Link to comment https://forums.phpfreaks.com/topic/124697-solved-trouble-inserting-information-in-to-my-db/ Share on other sites More sharing options...
ratcateme Posted September 17, 2008 Share Posted September 17, 2008 add "or die(mysql_error());" to the end of your mysql query line Scott. Link to comment https://forums.phpfreaks.com/topic/124697-solved-trouble-inserting-information-in-to-my-db/#findComment-644079 Share on other sites More sharing options...
genericnumber1 Posted September 17, 2008 Share Posted September 17, 2008 Try $query = mysql_query("INSERT INTO part_pricing (date_entered, price, machine, partnum, partname, description, cnc, dwg)". "VALUES ('$date', '$price', '$machine', '$partnum', '$partname', '$description', '$cnc', '$dwg')") or die(mysql_error()); and see if there's an error, if there isn't echo your query to make sure it looks okay. Link to comment https://forums.phpfreaks.com/topic/124697-solved-trouble-inserting-information-in-to-my-db/#findComment-644081 Share on other sites More sharing options...
F1Fan Posted September 17, 2008 Share Posted September 17, 2008 Maybe it wants a space in between the ) and VALUES "...dwg)VALUES ('..." $query = mysql_query("INSERT INTO part_pricing (date_entered, price, machine, partnum, partname, description, cnc, dwg) ". "VALUES ('$date', '$price', '$machine', '$partnum', '$partname', '$description', '$cnc', '$dwg')") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/124697-solved-trouble-inserting-information-in-to-my-db/#findComment-644085 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.