Updating Records

2 posts Page 1 of 1
Contributors
User avatar
Mark
VIP - Donator
VIP - Donator
Posts: 372
Joined: Mon Aug 17, 2009 10:35 pm

Updating Records
Mark
Hello,

I'm having problems with updating my records when i change from admin to member can anyone help me please this is my admin page code
Code: Select all
<?php
        if (isset($_GET['test']) && !empty($_GET['test'])){
    ?>
     
    
        
    <table>
    <tr>
        <td width='150px'>Users</td><td>Settings</td></tr>
        <td width='150px'></td><td></td></tr>
        <?php
            $list_query2 = mysql_query("SELECT id, username, user_level FROM users");
            while($run_list2 = mysql_fetch_array($list_query2)){
                $u_id1 = $run_list2['id'];
                $u_username1 = $run_list2['username'];
                $u_level1 = $run_list2['user_level'];
        ?>
        
        <tr><td><?php echo $u_username1 ?></td><td>
        
        <?php
        
            if($u_level1 == '1'){
                echo "<a href='options.php?u_id1=$u_id1&test=$u_level1'>Admin</a>";
            } else {
                echo "<a href='options.php?u_id1=$u_id1&test=$u_level1'>Member</a>";
            }
        ?>
        </td></tr>
        
        <?php
        }
        ?>
    
    </table>
    
    
    
    <?php    
        } else {
            echo "";  
    }
    ?>
This is the options page code
Code: Select all
<?php

include 'connection/connect.php';

include 'functions/functions.php';



$u_id1 = $_GET['u_id'];
$u_level1 = $_GET['user_level'];


if ($u_level1 == '1'){
    
    mysql_query("UPDATE `users` SET `user_level`='2' WHERE `id`='$u_id1'");
    echo "<meta http-equiv='refresh' content='0;url=admin.php?test=user'>"; 
    
}  else if($u_level1 == '2'){
    
    mysql_query("UPDATE `users` SET `user_level`='1' WHERE `id`='$u_id1'");
    echo "<meta http-equiv='refresh' content='0;url=admin.php?test=user'>"; 
    
}


?>
http://www.mbappz.com
Filip
Coding Guru
Coding Guru
Posts: 833
Joined: Wed Jan 05, 2011 3:59 pm

Re: Updating Records
Filip
Again, do you get any errors or did you try echoing the query and try running it with phpmyadmin or something similar?

I don't see any error in the code, and without proper context or query tests we can't really help you much..
CodenStuff wrote:
Nope, it's just your sick and dirty mind. You sick twisted warped little pervo :D
2 posts Page 1 of 1
Return to “Help & Support”