While returning no results
<p>I've got the following query in an existing script - but it's not always returning a value even though it should based off what's in the database.  There are plenty of things in the database it SHOULD be grabbing - they are there.</p>

<p>Don't see anything wrong with it - but I barely do this anymore :) See anything?</p>

<pre><code>$query = "SELECT id FROM xtags WHERE tag_id = '$tagid' ORDER BY RAND() Limit 2";
$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result)){

            $query = "SELECT * FROM xtable WHERE id = '$row[id]'";
            $result = mysql_query($query) or die(mysql_error());
            $row2 = mysql_fetch_assoc($result);
            echo $row2[title];

}
</code></pre>
