[PHP] while loop From: Ali (arsajedi <email protected>)
Date: 11/08/00

Hello all,

I have got a while loop which retrieve data from a DB. Within this while
loop I have got another while loop which retrieve its data from the same DB
if the if statement is fulfilled. My piece of code looks:

<?
if ($action == "alle") {
    $sql = "SELECT * FROM Rubriken ORDER BY rub_id";
    $q -> query ($DB, $sql);
    while ($row = $q ->getrow()) {
    echo $row['rubrik'];
        if ($rubrik == $row['run_name']) {
        $sql = "SELECT * FROM $rubrik ORDER BY id";
        $q -> query ($DB, $sql);
        $num = $q -> numrows();
            if ($num > 0) {
                while ($row = $q ->getrow()) {
                echo $row['unterrubrik'];
                }
            }
        }
    }
}
?>

Now my problem is that when $rubrik does not exists the first while loop
works fine. But when $rubrik exists the first while loop stops after doing
the second loop for the first time. Does anyone know why the first loop
behaves like this and not going through. I appreciate any help. Thank you.

Ali

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>