Cheater912 Posted September 6, 2008 Share Posted September 6, 2008 Hi, I'm trying to enter a large about of data in a database using PHP. I have 3 fields (id, dir, and password). The dir and passwords are simply hashes of the id number. The id number is going to be every number between 1000000 and 10000000. 27,000,000 strings need to be added in total. I get this error while running the script: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table (id, dir, password) VALUES ('1000001', '59e711d152de7bec7304a8c2ecaf9f0f',' at line 1" <?php $number = 1000000; mysql_connect("hidden", "hidden", "hidden") or die(mysql_error()); mysql_select_db("hidden") or die(mysql_error()); while($number < 10000000) { $number = $number + 1; mysql_query("INSERT INTO table (id, dir, password) VALUES ('" . $number . "', '" . md5($number) . "', '" . md5(sha1(md5($number))) . "')") or die(mysql_error()); } echo "Done!"; ?> What's wrong with the coding? Link to comment https://forums.phpfreaks.com/topic/122987-solved-mysql-insert-giving-me-an-error/ Share on other sites More sharing options...
Cheater912 Posted September 6, 2008 Author Share Posted September 6, 2008 Sorry for the double post, but sorry that this is in the wrong section. lol Link to comment https://forums.phpfreaks.com/topic/122987-solved-mysql-insert-giving-me-an-error/#findComment-635108 Share on other sites More sharing options...
Sulman Posted September 6, 2008 Share Posted September 6, 2008 It looks ok. Is 'table' the actual table name? Not sure if that is a reserved word. Are your table fields big enough to accomodate the data? Link to comment https://forums.phpfreaks.com/topic/122987-solved-mysql-insert-giving-me-an-error/#findComment-635116 Share on other sites More sharing options...
revraz Posted September 6, 2008 Share Posted September 6, 2008 You can't use Table as the Tablename. Link to comment https://forums.phpfreaks.com/topic/122987-solved-mysql-insert-giving-me-an-error/#findComment-635175 Share on other sites More sharing options...
Cheater912 Posted September 6, 2008 Author Share Posted September 6, 2008 You can't use Table as the Tablename. That worked, Thanks a lot! Link to comment https://forums.phpfreaks.com/topic/122987-solved-mysql-insert-giving-me-an-error/#findComment-635240 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.