Yes , thats the correct code , and this works for the exact same function , except i change the tables to grab info from another table.
the table names are correct
it's getting the userid from the profile thats currently being viewed
this function works
function view_friends_list($user_id) {
global $tb_favourites,$base_url;
$sql = "select * from $tb_favourites where user_id='$user_id'";
$res = mysql_query($sql) or die(mysql_error());
$out = "";
if(mysql_num_rows($res) == 0 ) {$out.= "This user Hasnt Added Any Freinds.";}
else {
while($rs = mysql_fetch_array($res)) {
$fav_name = get_username($rs['fav_user_id']);
$fuserid=$rs['fav_user_id'];
$out.= "<a class=\"link01\" href=\"/acct_profile.php?acctid=$fuserid\">$fav_name</a> ";
}
return $out;}
}
This one doesnt
function view_visit_list($user_id) {
global $tb_visits,$base_url;
$sql = "select * from $tb_visits where user_id='$user_id'";
$res = mysql_query($sql) or die(mysql_error());
$out = "";
if(mysql_num_rows($res) == 0 ) {$out.= "No one has viewed this profile yet.";}
else {
while($rs = mysql_fetch_array($res)) {
$fav_name = get_username($rs['view_id']);
$fuserid=$rs['view_id'];
$out.= "<a class=\"link01\" href=\"/acct_profile.php?acctid=$fuserid\">$fav_name</a> ";
}
return $out;}
}
Im totally lost