Hi, I have another problem with my scripy now I have made it more advance, first off the count function doesnt work properly and it gives this error.
*Warning: array_push() [function.array-push]: First argument should be an array in C:\wamp\www\social\add.php on line 42*
Here is my script:
$query = mysql_query("SELECT friends FROM users WHERE id='$myid'");
$friends = mysql_fetch_array($query);
$friends2 = unserialize($friends['friends']);
if (count($friends2) == 0) {
//option 1
$friends2 = array($id);
$friendsUpdated = serialize($friends2);
mysql_query("UPDATE users SET friends='$friendsUpdated' WHERE id='$myid'");
}else{
//option 2
array_push($friends2, $id);
$friendsUpdated = serialize($friends2);
mysql_query("UPDATE users SET friends='$friendsUpdated' WHERE id='$myid'");
Thnaks, Stanni