silverglade Posted August 3, 2009 Share Posted August 3, 2009 hi, im creating a "food" table and the browser is giving me an error when i run it, any help greatly appreciated. thank you. note that i put private, user, and pass, where my private info went. derek here is the code <?php // Make a MySQL Connection mysql_connect("private", "user", "pass") or die(mysql_error()); mysql_select_db("derek_test3") or die(mysql_error()); // Create a MySQL table in the selected database mysql_query("CREATE TABLE food( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), position VARCHAR(30), meal VARCHAR(30)") or die(mysql_error()); echo "Table Created!"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/168664-solved-error-in-my-code-creating-a-table/ Share on other sites More sharing options...
angelcool Posted August 3, 2009 Share Posted August 3, 2009 You are missing to put a closing parenthesis at the end of the query. Quote Link to comment https://forums.phpfreaks.com/topic/168664-solved-error-in-my-code-creating-a-table/#findComment-889927 Share on other sites More sharing options...
silverglade Posted August 4, 2009 Author Share Posted August 4, 2009 thanks. i dont see where i put it, it looks like i closed it already? sorry. can you show me where to put the closing parenthesis please? derek Quote Link to comment https://forums.phpfreaks.com/topic/168664-solved-error-in-my-code-creating-a-table/#findComment-890517 Share on other sites More sharing options...
silverglade Posted August 4, 2009 Author Share Posted August 4, 2009 i found out where to put it, took me a while LOL> meal VARCHAR(30))") thank you for the help! derek Quote Link to comment https://forums.phpfreaks.com/topic/168664-solved-error-in-my-code-creating-a-table/#findComment-890634 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.