Take out the while statement--
i.e. simply use:
$row = mysql_fetch_array($result);
the way you have things constructed now, the while statement evaluates true on the
first iteration and $row equals the result row from the query. Because the while
returned true, it is evaluated a second time, returns false, and $row = NULL.
-ib
Kevin Schaaps wrote:
> 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>";
> };
>
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]