Set status script. Help please

    Date: 02/05/07 (PHP Community)    Keywords: php, database

    I have the script which allows to register new users (field 'nick' in data base) and set their default status as "simpleuser" (field 'stat' in data base). And I want a page where all new users with status "simpleuser" will be listed one after another in table. And near each nick will be form where I could select a user's new status ('moderator' or 'administrator'). And after this table will be a button for subnision which updated database with new values.

    I've wtitten code. But it doesn't work :(

    So, it consists of two files [B]sending.php[/B] and [B]user_submit.php[/B].

    sending.php

    include('connection.php');

    $query = "SELECT id, nick, email FROM test WHERE stat = 'newuser'";
    $result = mysql_query($query) or die("ERROR: $query.".mysql_error());

    // if records are present
    if (mysql_num_rows($result) > 0) {
        $row = mysql_fetch_assoc($result);
        $id = $row->id;

        echo ""; 
            echo "";
            echo "";  
            echo "
    ".$row[nick]."".$row[email]."</a>
    ";
        echo "";
       
            echo "
        echo "";
        echo "";
        echo "";
     }

    else {
        echo 'No new users';
    }

    // close connection
    mysql_close($connection);

    ?>

    Problem here:
    There is only one user shown in the table, but in the db there're many of them. Why does it show only one?

    user_submit.php

    if (isset($_POST['submit'])) {

        include('connection.php');
       
        $result = mysql_query("UPDATE test SET stat = '{$_POST['newstat']}'  WHERE id = '{$_POST['id']}'");
        // close connection
        mysql_close($connection);


        // print success message   
        echo 'Done';
    }
    else {
        die('ERROR: Data not correctly submitted');
    }

    ?>

    The problem here is:
    It doesn't set new status to users. But I'm not sure that mistake which causes this problem in user_submit.php, it might be in sending.php

    Help me please.

    Source: http://community.livejournal.com/php/538392.html

    « Awesome PHP Career... || Logging package/systems »



antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home