davidspeare Posted March 12, 2007 Share Posted March 12, 2007 Hello all, I'm trying to run some script to populate a table that is already created. When I run the below code I am getting the completed message at the end, but my data is not going into my table....is there something incorrect with this code that is causing the issue? //make sure that we are using the right database mysql_select_db("test"); //insert data into "movietypeds table" $type = "INSERT INTO movietypeds (movietype_id, movietype_label) " . "VALUES (1, 'Sci Fi'), " . "(2, 'Drama'), " . "(3, 'Adventure'), " . "(4, 'War'), " . "(5, 'Comedy'), " . "(6, 'Horror'), " . "(7, 'Action'), " . "(8, 'Kids'), " . $results = mysql_query($type) or die(mysql_error()); echo "Completed"; ?> Thanks Quote Link to comment Share on other sites More sharing options...
rantsh Posted March 12, 2007 Share Posted March 12, 2007 Do you get an error of some sort? Quote Link to comment Share on other sites More sharing options...
davidspeare Posted March 12, 2007 Author Share Posted March 12, 2007 No error. Scirpt ran all the way through. Got the completed message at the end. Quote Link to comment Share on other sites More sharing options...
danx30 Posted March 12, 2007 Share Posted March 12, 2007 Are you missing the mysql_connect("127.0.0.1", "username", "password") or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
davidspeare Posted March 12, 2007 Author Share Posted March 12, 2007 no, i just have not posted it... the code is running...getting the "completed" confirmation, but it just isn't storing the data.. Quote Link to comment Share on other sites More sharing options...
davidspeare Posted March 12, 2007 Author Share Posted March 12, 2007 Just in case anyone was looking, the error was on the last line of my sql insert. I had: "(8, 'Kids'), " . and I should have had "(8, 'Kids') " ; I'm quickly learning that PHP is very particular. Thanks for the help though. Quote Link to comment 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.