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! Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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()); 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.