Update User Information Not Working

Hi Anyone,
Please I need some help with this code and its functionality. This code displays all the data in mysql database if user is logged in and an admin. I also added a functionality that allows the admin to update the book status of a user, but this not seem to work. Instead of changing the book status of that user it changes that of all the users in the database. I don’t know how to go about letting the admin input be specific to a particular user. pls help.
textpop-up

[php]
/* Function That Allows Admin To update User information which does not seem to work /
function book_status ($user_id, $book_status) {
update_user($user_data[‘user_id’], array(‘book_status’ => ‘0’));
}
/
Book Status Page */

<?php include 'core/init.php'; protect_page(); include('includes/overall/header.php'); $user_click = has_access($session_user_id, 1); $prefix = ($user_click == 1) ? "" : ''; $suffix = ($user_click == 1) ? '' : ''; ?>

<# type=“text/JavaScript”>
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function jsPhpFunction() {

<?php book_status(); ?>

}
</#script>

Book Status

Dear, <?php echo $user_data['first_name']?>!

Please Kindly Visit This page regularly to know the status of your book although you would be sent an email of which your Author's code would be included once the site Adminstrator has reviewed your book. Kindly bear with us we are working as fast we can to get your book reviewed as as soon as possible. <?php if (has_access($session_user_id, 1) === true) { echo '

If Admin Has Proof-read book you can click the pending under status to convert it to Reviewed

'; } else if (has_access($session_user_id, 2) === true) { echo '

If Admin Has Proof-read book you can click the pending under status to convert it to Reviewed

'; } if (has_access($session_user_id, 1) === true) { echo '

Click Here To Send Mass Email To All Users

'; } ?>
<?php if (has_access($session_user_id, 1) === true) { echo ''; } else if (has_access($session_user_id, 2) === true) { echo ''; }
        if (has_access($session_user_id, 1) === true) {
            echo '<td>Author\'s Code</td>';
        } else if (has_access($session_user_id, 2) === true) {
            echo '<td>Author\'s Code</td>';
        }
   ?>
    <td>Status</td>
    <td>Time</td>
    <?php
    $get_user_data = mysql_query("SELECT * FROM `users`");
    if (has_access($session_user_id, 1) === true) {
        while ($row = mysql_fetch_assoc($get_user_data))
        {
            $first_name = $row['first_name'];
            $last_name     = $row['last_name'];
            $title        = $row['title'];
            $author        = $row['author'];
            $category    = $row['category'];
            $book        = $row['book'];
            $author_code = $row['author_code'];
            $status        = $row['book_status'];
            $time        = $row['time'];
        ?>
            <tr>
            <td>
            <?php if (has_access($session_user_id, 1) === true) {
                echo $first_name;
            } else {
                echo $user_data['first_name'];
            }
            ?>
            </td>
            <td>
            <?php if (has_access($session_user_id, 1) === true) {
                echo $last_name;
            } else {
                echo $user_data['last_name'];
            }
           <?php
            </td>
            <td><?php echo $title ?></td>
            <td><?php echo $author?></td>
            <td><?php echo $category ?></td>
            <td><a href="<?php echo $book ?>" onclick="MM_openBrWindow(&#39;<?php echo $book ?>?>&#39;,&#39;&#39;,&#39;scrollbars=yes,re nsizable=yes,width=255,height=825&#39;)">Download User Book</a>
            </td>
            <td>
            <?php echo $author_code ?>
            </td>
            <td>
            <?php if (status($session_user_id, 1) === true) {
            echo "$prefix Reviewed $suffix";
            } else if (status($session_user_id, 0) === true) {
            echo "$prefix Pending  $suffix";
            }
            ?>
            </td>
        </tr>
        <?php
    }
} else {
<?php
    <tr>
    <td><?php echo $user_data['first_name']; ?></td>
    <td><?php echo $user_data['last_name']; ?></td>
    <td><?php echo $user_data['title'];?></td>
    <td><?php echo $user_data['author'];?></td>
    <td><?php echo $user_data['category'];?></td>
    <td>
    <?php if (status($session_user_id, 1) === true) {
        echo "$prefix Reviewed $suffix";
    } else if (status($session_user_id, 0) === true) {
        echo "$prefix Pending $suffix";
    }
    ?></td>
    <td><<?php echo $user_data['time']?>></td>
    </tr>
<?php
}
<?php
First Name Last Name Title Author CategoryBook URLBook URL
<?php include('includes/overall/footer.php'); ?>[/php]

Read this first

http://www.phphelp.com/forum/index.php?topic=14563.0

Sponsor our Newsletter | Privacy Policy | Terms of Service