Demonic Posted February 11, 2007 Share Posted February 11, 2007 I get this warning: Warning: array_push() [function.array-push]: First argument should be an array in /home/**********/public_html/N***********/battle.php on line 69 what this does if it doesn't have any voters it seralises the voter who just voted then if it has voters i unserialize it then array_push the next voter on the end of the array then update the sql. Any help on why It won't update? if($voteinfo[whovoted] == ""){ $voter = serialize($username); }else{ $whovotedonthis = unserialize($voteinfo[whovoted]); $voter = array_push($whovotedonthis,"$username"); } Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted February 11, 2007 Share Posted February 11, 2007 you should use single quotes to identify an array index (if its a string that is and i your case it loks to be. $voteinfo must have been an array initially check its NOT an object. if there is only one value in there it may retun as a scalar value and not be an array at all so you must check that it is an array first. (use either count() or better is_array()) if its just a scalar then you must make an array otherwsie your code should work. Quote Link to comment 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.