Monk3h Posted December 17, 2010 Share Posted December 17, 2010 I am a bit rust at SQL and have tried to make a simple insert query but failed. Please take a look and tell me where I went wrong. $sql = ("INSERT INTO carbontrust (contact, company, address, postcode, telephone, mobile, email, employees, turnover, assetvalue, sme, tradetime, nature, typeofo, companyregisteredname, regnumber, vatreg, regaddress, catapply, fuelused, otherfuel, heatingpercent, factoryspaceheating, officeheating, hotwater, heaterrating, existingheaters, setbackheating, billavailable, factorysize, roofheighte, roofheightr, builddate, spraybooths, dustextract, air, rollershutters, weekoc, occupancy, woodwaste, woodavailable, upload) VALUES ('$contact', '$company', '$address', '$postcode', '$telephone', '$mobile', '$email', '$employees', '$turnover', '$assetvalue', '$sme', '$tradetime', '$nature', '$typeofo', '$companyregisteredname', '$regnumber', '$vatreg', '$regaddress', '$catapply', '$fuelused', '$otherfuel', '$heatingpercent', '$factoryspaceheating', '$officeheating', '$hotwater', '$heaterrating', '$existingheaters', '$setbackheating', '$billavailable', '$factorysize', '$roofheighte', '$roofheightr', '$builddate', '$spraybooths', '$dustextract', '$air', '$rollershutters', '$weekoc', '$occupancy', '$woodwaste', '$woodavailable', '$upload')"); $sql = @mysql_query($sql); The variables have been defined from a POST form. When the variables are printed out they apear correct.. However they are not inserted into the database. Please help, been stuck for AGES. Thanks in advance, James. Quote Link to comment https://forums.phpfreaks.com/topic/221996-help-with-phpsql-query/ Share on other sites More sharing options...
Maq Posted December 17, 2010 Share Posted December 17, 2010 Temporarily change this line to: $sql = mysql_query($sql) or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/221996-help-with-phpsql-query/#findComment-1148718 Share on other sites More sharing options...
Monk3h Posted December 17, 2010 Author Share Posted December 17, 2010 Unknown column 'vatreg' in 'field list' Quote Link to comment https://forums.phpfreaks.com/topic/221996-help-with-phpsql-query/#findComment-1148720 Share on other sites More sharing options...
Maq Posted December 17, 2010 Share Posted December 17, 2010 Unknown column 'vatreg' in 'field list' 'vatreg' doesn't exist in your table. Quote Link to comment https://forums.phpfreaks.com/topic/221996-help-with-phpsql-query/#findComment-1148722 Share on other sites More sharing options...
Pikachu2000 Posted December 17, 2010 Share Posted December 17, 2010 That table has no column named vatreg, or it's misspelled, or miscapitalized in the query string. Quote Link to comment https://forums.phpfreaks.com/topic/221996-help-with-phpsql-query/#findComment-1148723 Share on other sites More sharing options...
Monk3h Posted December 17, 2010 Author Share Posted December 17, 2010 Spelling mistake FTL! Thanks mate! Been stuck on this for hours, didn't wanna get laughed out of a forum because I knew it would be a stupid mistake. Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/221996-help-with-phpsql-query/#findComment-1148724 Share on other sites More sharing options...
Maq Posted December 17, 2010 Share Posted December 17, 2010 Most mistakes are stupid and overly obvious, that's why they're so hard to recognize. Quote Link to comment https://forums.phpfreaks.com/topic/221996-help-with-phpsql-query/#findComment-1148729 Share on other sites More sharing options...
Pikachu2000 Posted December 17, 2010 Share Posted December 17, 2010 Don't worry, you won't get laughed out of here for that. No, we'll find some other reason . . . Quote Link to comment https://forums.phpfreaks.com/topic/221996-help-with-phpsql-query/#findComment-1148736 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.