Jump to content

Archived

This topic is now archived and is closed to further replies.

xyn

Sql Problem...

Recommended Posts

Heya!
I've got my SQL problem, I have a Buddies request system,
When a member receives a new request they must accept or
decline the request, however I get told I have a request
when i don't...

The problem is it ignroes the SQL Query and takes the first option
ie: It selects * (all) from the database where User is "ash"

I want it to check if the buddy is a request or already accepted.

My code:
[code=php:0]$BrSql = mysql_query("SELECT * FROM pm_buddy WHERE bdy_name='{$_SESSION['username']['usr_user']}' AND inf_accept='0'") or die('Error: '.mysql_error().'');
            $BrNum = mysql_num_rows( $BrSql );
            if( !BrNum ){
            echo "";
            }else{
            echo "<tr>
  <td width=\"100%\" class=\"text\">X <a href=\"./index.php?x=buddy.requests\">New Buddy Requests</a></td>
</tr>";
            }[/code]

Share this post


Link to post
Share on other sites
if( !BrNum ){
needs to be
if( !$BrNum ){

also i'm not sure if num rows returns blank or 0 when there are zero rows

Regards
Liam

Share this post


Link to post
Share on other sites
Lol indeed it does. Thanks :]]
I've hope i dont have the same day as i did yesturday i forggote things like
" and ) and ' most of my time was fixing errors Lol thx

Share this post


Link to post
Share on other sites
try using an editor which will auto complete them for you.
Or first write (, then ), and only then start writing your code. It saves me lots of time this kind of writing as I do not miss any (, {, " or '

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.