Jump to content


Photo

i don get it what could be wrong with line 19


  • This topic is locked This topic is locked
2 replies to this topic

#1 wawenka

wawenka
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 October 2006 - 08:06 AM

i get this message all the tym.
Parse error: syntax error, unexpected T_VARIABLE in /var/www/inventory files/process1.php on line 19 
my code is:<html>
<body>
// Set Mysql Variables
<?php
$host = 'localhost';
$user = 'root';
$pass = '';
$db = 'KenetInventory';
$table = 'Equipment';

// Set global variables to easier names
$ItemNo = $_POST['ItemNo'];
$Manufacturer = $_POST['Manufacturer'];
$Model = $_POST['Model'];
$SerialNO = $_POST['SerialNo'];
$Description = $_POST['Description'];
mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db(KenetInventory) or die(mysql_error());
$add_all = 'INSERT INTO Equipment values('$ItemNo','$Manufacturer','$Model','$SerialNo','$Description','')';
mysql_query($add_all) or die(mysql_error());
}
?>
</body>
</html>



#2 sofaman

sofaman
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 27 October 2006 - 03:38 PM

Hi,
I'm a newbie too,

I think the code should look more like this, but some one will put us right if we are wrong !!!

$add_all = "INSERT INTO Equipment 
	(ItemNo, Manufacturer, Model, SerialNo, Description)
	VALUES ('$ItemNo','$Manufacturer','$Model','$SerialNo','$Description')";

BTW you also have a trailing } on line 25 ??

Try this:


<html>
<body>
// Set Mysql Variables
<?php
$host = 'localhost';
$user = 'root';
$pass = '';
$db = 'KenetInventory';
$table = 'Equipment';

// Set global variables to easier names
$ItemNo = $_POST['ItemNo'];
$Manufacturer = $_POST['Manufacturer'];
$Model = $_POST['Model'];
$SerialNO = $_POST['SerialNo'];
$Description = $_POST['Description'];
mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db(KenetInventory) or die(mysql_error());
$add_all = "INSERT INTO Equipment 
	(ItemNo, Manufacturer, Model, SerialNo, Description)
	VALUES ('$ItemNo','$Manufacturer','$Model','$SerialNo','$Description')";
mysql_query($add_all) or die(mysql_error());

?>
</body>
</html>


Good luck and let me know how you get on


I have 2 arms and 4 legs :D
www.clubvauxhall.net

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 28 October 2006 - 04:01 PM

Now that this problem has been resolved in two duplicate threads, I think that's more than sufficient.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users