SirChick Posted October 24, 2007 Share Posted October 24, 2007 I keep getting this error with my script, not sure why the field name is correctly spelt so I'm kinda confused on what its telling me that i got wrong.. this is my code: $GetBusinessType = mysql_query("SELECT * FROM businesstypes WHERE Businesstype='$Business' order by BusinessID Limit 0,1") or die(mysql_error()); // Fetch the row from the database if (!($row = mysql_fetch_assoc($GetBusinessType))) { echo "Business not found!"; echo mysql_error(); } $businessname = $row['BusinessName']; Error Column count doesn't match value count at row 1 Quote Link to comment https://forums.phpfreaks.com/topic/74655-solved-column-count-doesnt-match-value-count-at-row-1/ Share on other sites More sharing options...
BlueSkyIS Posted October 24, 2007 Share Posted October 24, 2007 that error is typically for an UPDATE or INSERT statement, not a SELECT. Quote Link to comment https://forums.phpfreaks.com/topic/74655-solved-column-count-doesnt-match-value-count-at-row-1/#findComment-377365 Share on other sites More sharing options...
SirChick Posted October 24, 2007 Author Share Posted October 24, 2007 Oh in that case it must be this ... $BusinessID = 1; $businesstype = Food Market; $query = "INSERT INTO `businesses` (BusinessID, OwnerID, BusinessType) Values ('$BusinessID', '{$_SESSION['Current_User']}, '$businesstype')"; mysql_query($query) or die(mysql_error()); Managed to get another error in the process lol : 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 'Food Market')' at line 2 Quote Link to comment https://forums.phpfreaks.com/topic/74655-solved-column-count-doesnt-match-value-count-at-row-1/#findComment-377369 Share on other sites More sharing options...
BlueSkyIS Posted October 24, 2007 Share Posted October 24, 2007 yes, you're missing a quote: '{$_SESSION['Current_User']}, should be '{$_SESSION['Current_User']}', Quote Link to comment https://forums.phpfreaks.com/topic/74655-solved-column-count-doesnt-match-value-count-at-row-1/#findComment-377372 Share on other sites More sharing options...
BlueSkyIS Posted October 24, 2007 Share Posted October 24, 2007 with SQL problems, it helps a lot if you echo out the SQL so you can see it. then it usually becomes very obvious what the problem is. Quote Link to comment https://forums.phpfreaks.com/topic/74655-solved-column-count-doesnt-match-value-count-at-row-1/#findComment-377373 Share on other sites More sharing options...
SirChick Posted October 24, 2007 Author Share Posted October 24, 2007 How is that done ? Good eye by the way! think its time i took a well earned break seeing as i missed that ! Quote Link to comment https://forums.phpfreaks.com/topic/74655-solved-column-count-doesnt-match-value-count-at-row-1/#findComment-377375 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.