*Confused* - Displaying tables

Can someone tell me why this query only displays one result in a table, and not all at once?

SELECT * FROM users_messages WHERE to_nickname='$_SESSION[nicksess]';

I am confused. :blush:

Screenshot: http://img16.myimg.de/examplebb6f4.png

What code are you using to fetch the result set from the database server (MySQL?)?

The query doesn’t display anything, it only returns a result set to your PHP script. So if your script only shows one row, and the result of that query should be multiple rows, probably something is wrong in your PHP code.

Post it here please.

This one:


$get_msgs = mysql_query("SELECT * FROM users_messages WHERE to_nickname='$_SESSION[nicksess]'");
   while ($msg = mysql_fetch_assoc($get_msgs))
   {

     $id     = $msg['id'];
     $from   = $msg['from_nickname'];
     $subj   = $msg['subject'];
     $messg  = $msg['message'];
     $d_sent = $msg['date_sent'];
     $t_sent = $msg['time_sent'];

   }


There’s no displaying going on inside that loop.
If you display those variables outside the loop, then you’ll show only the last row from the mysql result set.

Saved me some time again. Thanks. :slight_smile: