Jump to content


Photo

Sql Problem...


  • Please log in to reply
4 replies to this topic

#1 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 22 September 2006 - 11:19 AM

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:
$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>";
            		}


#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 22 September 2006 - 11:31 AM

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
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 22 September 2006 - 11:34 AM

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

#4 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 22 September 2006 - 11:40 AM

haha no problem,
we all have them days i blame it on the KB most of the time :P
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#5 radalin

radalin
  • Members
  • PipPipPip
  • Advanced Member
  • 179 posts

Posted 22 September 2006 - 11:41 AM

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 '
Roy Simkes
Yet Another Parkyeri Developer




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users