Jump to content

Archived

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

wawenka

i don get it what could be wrong with line 19

Recommended Posts

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>

Share this post


Link to post
Share on other sites
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 !!!

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

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

Try this:


[code]<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>[/code]


Good luck and let me know how you get on

Share this post


Link to post
Share on other sites
Now that this problem has been resolved in two duplicate threads, I think that's more than sufficient.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×

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.