我的 mysql 查询中的 order by 有问题。如果没有“ WHERE adder
='$followuser' ”,查询工作正常。但是使用 WHERE 是 ORDER BY 不起作用。你能帮我吗?:) 这是我的代码:
$time=time();
$checkfollowing=mysql_query("SELECT * FROM `follow` WHERE `follower`='$session'") or die(mysql_error()); /* Check if is user following somebody */
if(mysql_num_rows($checkfollowing) == FALSE){ /* He's following no one */
echo "You follow noone";
die();
}elseif(mysql_num_rows($checkfollowing) == TRUE){ /* He's following somebody */
while($row11=mysql_fetch_array($checkfollowing)){
$followuser=$row11['get_follow'];
$fcontent=mysql_query("SELECT * FROM `followcontent` WHERE `adder`='$followuser' ORDER BY id DESC") or die (mysql_error()); /* Follow content */
while($row=mysql_fetch_assoc($fcontent)){
$id=$row['id'];
$photourl=$row['photourl'];
$adder=$row['adder'];
echo "<hr class='style'><br><div id='newadder'>".$adder."</div><a href='photo/?id=".$id."'><img src='".$photourl."' class='newfolimg'></a>";
}
} }
十分感谢 :))