Hi all,
Hoping someone will be able to tell me where I am going wrong. What I am trying to achieve is to pull an array string from a database add a player to it then update the string in the database. Here is the code that I am using.The if statement does not work either it just adds the player over and over and does not find the player that has signed up twice.
$recievearrayresults = mysql_fetch_array($recievearray);
$playerarray = array(Unserialize($recievearrayresults['players']));
if(in_array("$userid",$playerarray)){
die ("You are already in this tourney".mysql_error());
}
else{
array_push($playerarray,$userid);
$newplayerarray = serialize($playerarray);
$b = mysql_query("UPDATE gameplayers SET players='$newplayerarray' WHERE game='$gamenumber'");
$playerarraycount = count($playerarray); // used to tell if its been added then I echo it out
Thanks heaps for helping