scott.stephan Posted June 27, 2009 Share Posted June 27, 2009 I'm running this and everything looks 100% correct: $qry_lots_id = "INSERT INTO lots_new(lot,lot_qty,lot_rec,lot_sku_id) VALUES($s_k_row[1],$s_k_row[0],$s_k_row[2],$s_k_row[3])"; $result = @mysql_query($qry_lots_id); I ran an echo on the query and it outputs what I expect: QUERY: INSERT INTO lots_new(lot,lot_qty,lot_rec,lot_sku_id) VALUES(RCP0195,998,1,2) And yet nothing ends up in the table. The field names and table names are 100% correct. The code executes fine. It must be a syntax thing, but I'm not seeing it. Help? Link to comment https://forums.phpfreaks.com/topic/163903-solved-problem-with-inserting-multiple-values/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 27, 2009 Share Posted June 27, 2009 String values must be enclosed in single-quotes. And there is absolutely no reason to put an @ in front of a mysql_query() statement. Don't use @ in your code to suppress error messages, it just slows down your code, even when there is no error (yes, just putting the @ in your code, slows down your code.) Link to comment https://forums.phpfreaks.com/topic/163903-solved-problem-with-inserting-multiple-values/#findComment-864746 Share on other sites More sharing options...
cunoodle2 Posted June 27, 2009 Share Posted June 27, 2009 I think you need single quotes around the "non integer" fields as far as I can remember. Link to comment https://forums.phpfreaks.com/topic/163903-solved-problem-with-inserting-multiple-values/#findComment-864747 Share on other sites More sharing options...
scott.stephan Posted June 27, 2009 Author Share Posted June 27, 2009 I always get hung up on the quotes stuff. Always. You think I would have learned. Thanks guys! Link to comment https://forums.phpfreaks.com/topic/163903-solved-problem-with-inserting-multiple-values/#findComment-864750 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.