thedestroyer Posted July 29, 2009 Posted July 29, 2009 in all my files that send events out eg when you buy something from the market or attack someone i get this error QUERY ERROR: Column count doesn't match value count at row 1 Query was INSERT INTO events VALUES('',3,UNIX_TIMESTAMP(),0, can someone help please? Quote
PHP Scene Posted July 29, 2009 Posted July 29, 2009 Re: Error with coding need help please Have you modified the events table? or modified the add_event() function? Quote
thedestroyer Posted July 29, 2009 Author Posted July 29, 2009 Re: Error with coding need help please i didnt edit the table heres the event function line i think i need to change $db->query("INSERT INTO events VALUES('',$userid,UNIX_TIMESTAMP(),0,'$text')"); Quote
CrazyT Posted July 30, 2009 Posted July 30, 2009 Re: Error with coding need help please i didnt edit the table heres the event function line i think i need to change $db->query("INSERT INTO events VALUES('',$userid,UNIX_TIMESTAMP(),0,'$text')"); Have you cleaned the text?... $db->escape($text) o.o Quote
thedestroyer Posted July 30, 2009 Author Posted July 30, 2009 Re: Error with coding need help please so what line should i be putting? Quote
thedestroyer Posted July 30, 2009 Author Posted July 30, 2009 Re: Error with coding need help please ok this is my whole event function function event_add($userid,$text,$connection=0) { global $db; $text=mysql_escape($text); $db->query("INSERT INTO events VALUES('',3,UNIX_TIMESTAMP(),0,'$text')"); $db->query("UPDATE users SET new_events=new_events+1 WHERE userid={$userid}"); return 1; Quote
shrek1609 Posted July 30, 2009 Posted July 30, 2009 Re: Error with coding need help please function event_add($userid,$text,$connection=0) { global $db; $text=mysql_escape($text); $db->query("INSERT INTO events VALUES('',$userid,UNIX_TIMESTAMP(),0,'$text')"); $db->query("UPDATE users SET new_events=new_events+1 WHERE userid={$userid}"); return 1; } this is my events function... go into phpmyadmin and check the events table you should have these fields `evID` int(11) NOT NULL auto_increment, `evUSER` int(11) NOT NULL default '0', `evTIME` int(11) NOT NULL default '0', `evREAD` int(11) NOT NULL default '0', `evTEXT` text NOT NULL, Quote
shrek1609 Posted July 30, 2009 Posted July 30, 2009 Re: Error with coding need help please if you don't have those five events then delete the events table and run this in the sql query... CREATE TABLE IF NOT EXISTS `events` ( `evID` int(11) NOT NULL auto_increment, `evUSER` int(11) NOT NULL default '0', `evTIME` int(11) NOT NULL default '0', `evREAD` int(11) NOT NULL default '0', `evTEXT` text NOT NULL, PRIMARY KEY (`evID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; Quote
thedestroyer Posted July 30, 2009 Author Posted July 30, 2009 Re: Error with coding need help please i still get this error with your function QUERY ERROR: Column count doesn't match value count at row 1 Query was INSERT INTO events VALUES('',550,UNIX_TIMESTAMP(),0 Quote
shrek1609 Posted July 30, 2009 Posted July 30, 2009 Re: Error with coding need help please did you go into phpmyadmin and check the events table... thats where your problem is you've either added an extra field or deleted one... check the table there should be 5 fields if not delete the events table and run that query i gave you... Quote
thedestroyer Posted July 30, 2009 Author Posted July 30, 2009 Re: Error with coding need help please ah got it it was a table i added thanks a bunch shrek :-) Quote
shrek1609 Posted July 30, 2009 Posted July 30, 2009 Re: Error with coding need help please no problem :-) Quote
thedestroyer Posted July 30, 2009 Author Posted July 30, 2009 Re: Error with coding need help please i gave you a +1 Quote
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.