I'm trying to perform a SELECT query to two different tables, the second query using information from the first to do so. The first query goes all right and returns its stuff after using fetch_array, but the second returns nothing.
//Select posts
$result=mysql_query("SELECT * FROM posts WHERE topic='$topic'");
$select=mysql_fetch_array($result);
//Select user details
$user=$select[0];
$userselect=mysql_query("SELECT * FROM users WHERE username='$user'");
$userdetails=mysql_fetch_assoc($userselect);
echo $userdetails['username'];
There is no output from this code segment whatsoever. I know for sure that there is something for it to return, the data to be selected does exist in the table.