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);

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.