How do I return the numeric value from a database query in PHP?

Posted by Luke on Stack Overflow See other posts from Stack Overflow or by Luke
Published on 2010-06-07T16:13:22Z Indexed on 2010/06/07 16:22 UTC
Read the original article Hit count: 146

Filed under:
|

Hello, I am looking to retreive a numerical value from the database

function adminLevel()
{
   $q = "SELECT userlevel FROM ".TBL_USERS." WHERE id = '$_SESSION[id]'";
   return mysql_query($q, $this->connection);
}

This is the SQL.

I then wrote the following php/html:

    <?php 
    $q = $database->adminLevel();
    if ($q > 7)
    {
        ?>
        <a href="newleague.php">Create a new league</a>
        <?
    }
    ?>

The problem I have is that the userlevel returned isn't affecting the if statement. It is always displayed. How do i get it to test the value of userlevel is greater than 7?

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql