Result is not empty
| From: | Kevin Schaaps | Date: | Wed, 21 Nov 2001 01:23:11 +0000 |
| Subject: | Result is not empty | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-14487@lists.php.net to get a copy of this message | ||
Greetings once again,
Today I hope to have a challenge for you. :)
I've created a query which returns 1 record. This is confirmed when testing
it in MySQL itself.
Now PHP sees that there is 1 record in the result, but is completely
unwilling to show the information.
The css responsible for that page does not change the color of the text so
it should (like all the rest of the page is) be visible.
Please help :)
Yours,
Kevin
____________________________________________
$query = "SELECT concat(rank_tbl.abbreviation, ' ', character_tbl.name, '
',
character_tbl.surname) as CO,
character_tbl.ircnick, character_tbl.email FROM
character_tbl, rank_tbl, sim_tbl WHERE sim_tbl.co = character_tbl.id
AND character_tbl.rank = rank_tbl.id AND sim_tbl.co =
character_tbl.id AND character_tbl.rank = rank_tbl.id
AND sim_tbl.id = $sim_id";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
if ($num_rows == 1)
{
while ($row = mysql_fetch_array($result));
{
$co = $row["CO"];
$nick = $row["ircnick"];
$email = $row["email"];
};
echo "
<table>
<tr>
<td width=\"50\"></td>
<td width=\"125\">CO:<td>
<td><a href=\"$email\">$co</a></td>
</tr>
<tr>
<td width=\"50\"></td>
<td width=\"125\">IRC NICK<td>
<td>$nick</td>
</tr>
<tr>
<td width=\"50\"></td>
<td width=\"125\"><td>
<td></td>
</tr>
</table>";
}
else
{
echo "<br> <p class=\"medium\">No Commanding Officer assigned to
$name</p>";
};