your code looks strange.
wouldn't be better if you would do something like this?
$query11 = "SELECT * FROM user WHERE active = 1 AND id = $row AND inrotation = 1";
$query_id=mysql_query($query11);
$curRecord=array();
while ($curRecord = mysql_fetch_array($query_id))
{
if ($curRecord["id"]!="0" && $curRecord["id"]!=$oldid)
{
$id=$curRecord["id"];
$url=$curRecord["picurl"];
break;
}
}
just a few questions:
is field id numeric or is it a string?
If it's numeric than you should write id==0
(without the double quotes).
if it's a string is its default value 0 or NULL (null as a constant)? If you are checking if the field is not NULL than you should use isset() function.