Question: I am pulling messages from mysql using PHP to be displayed on a specific page. Instead of displaying the title of the message in the designated title bar and the message in the designated body text box...there is no content displayed and its displaying the title in the url. What am I missing in my query? Or what is going on?

```
/*--Here is my query--*/

$query = "SELECT * FROM `Messages` WHERE `id` = '" .$messageid. "'";
            $request = mysql_query($query,$connection) or die(mysql_error());
            $Readmessages = mysql_fetch_array($request);

             $query = "SELECT * FROM `Users` WHERE `id` = '".$Readmessages['sentFrom'] ."'";
             $request2 = mysql_query($query,$connection);
             $sender = mysql_fetch_array($request2);

/*--Here is my code--*/

```

Answer: 
First of all, you don't have to use . (append) on the $messageid - vis:

```
$query = "SELECT * FROM `Messages` WHERE `id` = '$messageid'";

```

Second, check to see if you actually returned a row
and, (here's the clincher) use `mysql_fetch_assoc()` instead of `mysql_fetch_array()` - or you won't get the field names.

```
if ( $Readmessages = mysql_fetch_assoc($request) )
{
   $sentfrom = $Readmessages['sentFrom'];
   if (strlen($sentfrom) > 0)
   {
      $query = "SELECT * FROM `Users` WHERE `id` = '$sentfrom'";
      ...
   }
}

```

if you want to check your query, you can output it in your html, and look at the source:

```
echo "<!-- <sql>$query</sql> -->";

```
When code does somthing you don't expect it to -- double check your assumptions.

1) Make sure $messageid is populated with what you need

2) Make sure the row you're returning isn't null - i.e. its working just the data is null