I'm running a query on a table, here is the code
<?php
$sql = "SELECT * FROM links WHERE linkfrom = '".$userid."'";
//Select everything from the users field where the Username is the same as the Cookie Variable
$query = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_assoc($query)) {
$linkfrom = $row['linkfrom'];
$sql2 = "SELECT * FROM updates WHERE user = '".$linkfrom."'";
}
//Select everything from the users field where the Username is the same as the Cookie Variable
$query = mysql_query($sql2) or die(mysql_error());
while($row = mysql_fetch_assoc($query)) {
if($row['gender'] == "Male"){
echo $row['fullname']." ".$row['type']." ".$row['network']." on his profile";
}else{
echo $row['fullname']." ".$row['type']." ".$row['network']." on her profile";
}
}
?>
Within the table LINKs I have the fields
linkto linkfrom fullnameto fullnamefrom
When I change linkfrom to linkto which is what I want it to be, it returns nothing, although when I have it set to linkfrom it returns something.
Basically what I'm trying to do is pull records from the UPDATE table where the field USER is the same as LINKTO when the field LINKFROM is the same as the logged in user (userid)
Any ideas why it's not working?


Sign In
Create Account


Back to top










