Make sure you read about joins, as others have mentioned. Issuing multiple statements when one will do is inefficient and wastes resources. Let the database handle data operations and the program handle everything else. Lastly, don't use SELECT *; select only the columns you need.
–
outisDec 14 '10 at 13:48

Thank You for the tips. I will indeed read the PDO articles and switch to joins for efficiency.
–
GesterXDec 14 '10 at 14:43

You need to do a INNER JOIN or a LEFT JOIN. Yes after carefully seeing the question again, I found that when doing the "mysql_fetch_array()" code for the first time (just before the "while" loop), the value of the variable "$listquests2" gets lost. So the "while" loop does nothing fruitful.

You only have one row, and you fetched that row when you called mysql_fetch_array the first time. When you call it the second time, there are no more rows to fetch in the result set, the function returns false and your loop exits.

This statement: "$listquests3=mysql_fetch_array($listquests2);" already fetches the first. Sicne you have only one, there's nothing more to fetch, so the next call to mysql_fetch_array will return nothing.

That should fix it, but for your own 'experience', this might be a good moment to start learning about MySQL joins (LEFT JOIN in particular). You can easily find a lot about it on the internet!