schalk1807
10-28-2012, 05:21 PM
Can anyone please tell me why this function is returning the user_id as contained in the $friends variable, instead of the first_name and last_name?
public function getFriendsById($friends) {
$sql="SELECT first_name, last_name FROM users WHERE user_id =". $friends;
$results = mysql_query($sql)or die("Selection Query Failed !!!");
$friendsNames = array();
while ($row = mysql_fetch_array($results)){
$friendsNames[] = $row['first_name, last_name'];
}
return $friendsNames;
}
}
public function getFriendsById($friends) {
$sql="SELECT first_name, last_name FROM users WHERE user_id =". $friends;
$results = mysql_query($sql)or die("Selection Query Failed !!!");
$friendsNames = array();
while ($row = mysql_fetch_array($results)){
$friendsNames[] = $row['first_name, last_name'];
}
return $friendsNames;
}
}