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 Link to comment https://forums.phpfreaks.com/topic/42391-newbie/ 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? Link to comment https://forums.phpfreaks.com/topic/42391-newbie/#findComment-205629 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. Link to comment https://forums.phpfreaks.com/topic/42391-newbie/#findComment-205675 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()); Link to comment https://forums.phpfreaks.com/topic/42391-newbie/#findComment-205678 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.. Link to comment https://forums.phpfreaks.com/topic/42391-newbie/#findComment-205691 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. Link to comment https://forums.phpfreaks.com/topic/42391-newbie/#findComment-205759 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.