<?php mysql_connect("localhost","root","root") or die (mysql_error);
		mysql_select_db("test") or die (mysql_error);
		
		$ProductName = $_POST['ProductName'];
		$Price = $_POST['Price'];
		$Quantity = $_POST['Quantity'];
		$Description = $_POST['Description'];
		
		 $query = "insert into ProductTable(ProductName,Price,Quantity,Description) value
		 	('$ProductName','$Prioce','$Quantity','$Description')";
			
			
			mysql_query($query) or die ($query);
			
			?>

i already review it,i have the database and is also connected and yet the browser is just displaying the query line...can u help me about this?

Recommended Answers

All 2 Replies

Well, you could try this to catch the error instead of letting it be silent:

<?php mysql_connect("localhost","root","root") or die (mysql_error);
		mysql_select_db("test") or die (mysql_error);
		
		$ProductName = $_POST['ProductName'];
		$Price = $_POST['Price'];
		$Quantity = $_POST['Quantity'];
		$Description = $_POST['Description'];
		
		 $query = "insert into ProductTable(ProductName,Price,Quantity,Description) value
		 	('$ProductName','$Prioce','$Quantity','$Description')";
			
			
mysql_query($query) or die('\"'.$query.'\" Query failed: ' . mysql_error());
			
			?>
Member Avatar for diafol

$Prioce isn't $Price - but I doubt that would cause an sql failure.

Shouldn't 'value' be 'values'?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.