Jump to content

[SOLVED] trouble inserting information in to my DB


aebstract

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.