xyn Posted September 22, 2006 Share Posted September 22, 2006 Heya!I've got my SQL problem, I have a Buddies request system,When a member receives a new request they must accept ordecline the request, however I get told I have a requestwhen i don't...The problem is it ignroes the SQL Query and takes the first optionie: 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] Link to comment https://forums.phpfreaks.com/topic/21650-sql-problem/ Share on other sites More sharing options...
shocker-z Posted September 22, 2006 Share Posted September 22, 2006 if( !BrNum ){needs to beif( !$BrNum ){also i'm not sure if num rows returns blank or 0 when there are zero rowsRegardsLiam Link to comment https://forums.phpfreaks.com/topic/21650-sql-problem/#findComment-96637 Share on other sites More sharing options...
xyn Posted September 22, 2006 Author Share Posted September 22, 2006 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 Link to comment https://forums.phpfreaks.com/topic/21650-sql-problem/#findComment-96639 Share on other sites More sharing options...
shocker-z Posted September 22, 2006 Share Posted September 22, 2006 haha no problem,we all have them days i blame it on the KB most of the time :P Link to comment https://forums.phpfreaks.com/topic/21650-sql-problem/#findComment-96641 Share on other sites More sharing options...
radalin Posted September 22, 2006 Share Posted September 22, 2006 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 ' Link to comment https://forums.phpfreaks.com/topic/21650-sql-problem/#findComment-96642 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.