wawenka Posted October 27, 2006 Share Posted October 27, 2006 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> Link to comment Share on other sites More sharing options...
sofaman Posted October 27, 2006 Share Posted October 27, 2006 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 Link to comment Share on other sites More sharing options...
fenway Posted October 28, 2006 Share Posted October 28, 2006 Now that this problem has been resolved in two duplicate threads, I think that's more than sufficient. Link to comment Share on other sites More sharing options...
Recommended Posts