timmah1 Posted November 7, 2008 Share Posted November 7, 2008 I'm getting an error with this code, and I cannot for the life of me, find it. $sql = "INSERT INTO clients(clientID, client, clientName, date, addr, city, state, zip, company, ext, cell, fax, email, level, tax, latedays, amount, terms, days, desc, active) VALUES( '$clientID', '$client', '$clientName', '$date', '$addr', '$city', '$state', '$zip', '$company', '$ext', '$cell', '$fax', '$email', '$level', '$tax', '$latedays', '$amount', '$terms', '$days', '$desc', '$active');"; mysql_query($sql) or die("Sorry, there was a problem adding client ".mysql_error()); The error I'm getting is this Sorry, there was a problem adding client 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 'desc, status) VALUES( '0CZS', '', '', '', '', ' at line 1 Can anybody spot the error? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/131788-solved-insert-error/ Share on other sites More sharing options...
Mchl Posted November 7, 2008 Share Posted November 7, 2008 desc is MySQL reserved word. Either change column name, or use it in ``. Link to comment https://forums.phpfreaks.com/topic/131788-solved-insert-error/#findComment-684590 Share on other sites More sharing options...
timmah1 Posted November 7, 2008 Author Share Posted November 7, 2008 I knew it had to be something simple. Thank you mchl Link to comment https://forums.phpfreaks.com/topic/131788-solved-insert-error/#findComment-684591 Share on other sites More sharing options...
Mchl Posted November 7, 2008 Share Posted November 7, 2008 Well... I'm surprised that 'date' column didn't trigger it. You might want to take care of it as well. Link to comment https://forums.phpfreaks.com/topic/131788-solved-insert-error/#findComment-684593 Share on other sites More sharing options...
timmah1 Posted November 7, 2008 Author Share Posted November 7, 2008 I've never had a problem with 'date', but I usually don't use it anymore, but old habits are sometimes hard to break. Thanks again for your help Link to comment https://forums.phpfreaks.com/topic/131788-solved-insert-error/#findComment-684603 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.