forumnz Posted April 26, 2009 Share Posted April 26, 2009 Why does this not work? It just doesn't insert anything.. mysql_query("INSERT INTO chart_of_accs (hash_key, acc_hash, type, code, name, description, tax, show_exp_claims, sys_locked) VALUES ('$demo_hash', '" . md5(rand() . rand() . rand()) . "', 'r_r', '200', 'Sales', 'Income', 'gst_n', '0', '0'), ('$demo_hash', '" . md5(rand() . rand() . rand()) . "', 'e_o', '400', 'Advertising', 'Advertising', 'gst_n', '0', '0')"); Thanks Sam Quote Link to comment https://forums.phpfreaks.com/topic/155763-solved-inserting-multiple-rows-within-one-query/ Share on other sites More sharing options...
premiso Posted April 26, 2009 Share Posted April 26, 2009 Probably due to type being in art of the columns. Add this to see the error: mysql_query("INSERT INTO chart_of_accs (`hash_key`, `acc_hash`, `type`, `code`, `name`, `description`, `tax`, `show_exp_claims`, `sys_locked`) VALUES ('$demo_hash', '" . md5(rand() . rand() . rand()) . "', 'r_r', '200', 'Sales', 'Income', 'gst_n', '0', '0'), ('$demo_hash', '" . md5(rand() . rand() . rand()) . "', 'e_o', '400', 'Advertising', 'Advertising', 'gst_n', '0', '0')") or die(mysql_error()); Give that a try and see what it returns. Quote Link to comment https://forums.phpfreaks.com/topic/155763-solved-inserting-multiple-rows-within-one-query/#findComment-819929 Share on other sites More sharing options...
forumnz Posted April 27, 2009 Author Share Posted April 27, 2009 It just comes up with: 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 'assets', 'gst_n', '0', '0'), ('4dee86e7c8696a5e41d71ef9a31c3682', '68317fcd9aec' at line 9 What does this mean? Quote Link to comment https://forums.phpfreaks.com/topic/155763-solved-inserting-multiple-rows-within-one-query/#findComment-819946 Share on other sites More sharing options...
premiso Posted April 27, 2009 Share Posted April 27, 2009 That you are showing us the wrong code. I do not see assets in the code you provided anywhere. , I see "Income" where assets should be. Quote Link to comment https://forums.phpfreaks.com/topic/155763-solved-inserting-multiple-rows-within-one-query/#findComment-819950 Share on other sites More sharing options...
forumnz Posted April 27, 2009 Author Share Posted April 27, 2009 There is no 'assets' being inserted anywhere in the code.. thats what I don't get..? Quote Link to comment https://forums.phpfreaks.com/topic/155763-solved-inserting-multiple-rows-within-one-query/#findComment-819963 Share on other sites More sharing options...
forumnz Posted April 27, 2009 Author Share Posted April 27, 2009 Thanks - got it! Quote Link to comment https://forums.phpfreaks.com/topic/155763-solved-inserting-multiple-rows-within-one-query/#findComment-819964 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.