Ver originalwhile($post = mysql_fetch_assoc($postmax)) { $dfg = $post['id']; // Aqui haces la otra consulta.}