Jump to content

Probably easy solution, but its got me stumped!


melting_dog

Recommended Posts

Hi guys,

 

I have a simple INSERT code. It does not throw any errors and all seems ok but the data is just not appearing in the DB. I've spent ages looking over it but perhaps a 2nd set of eyes could help?

 

Thanks!

 

	$con = mysql_connect("localhost","posturep","");

	$tablename = 'product';

if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
	  
        //Form data sent

	$product_name = $_POST['product_name'];  
	$product_active = $_POST['product_active'];  
	$product_cat = $_POST['product_cat'];  
	$product_desc = $_POST['product_desc'];  
	$prod_inoutdoor = $_POST['prod_inoutdoor']; 
	$prod_stackable = $_POST['prod_stackable']; 
	$prod_discounted = $_POST['prod_discounted'];  

	echo $product_name;

	$sql = "INSERT INTO $tablename (name) VALUES ($product_name)";

	mysql_query($sql);		
			echo "<p>Product Saved!</p>";
			echo $sql;	
	mysql_close($con);

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.