sandrob57 Posted February 27, 2007 Share Posted February 27, 2007 would this work? $result = dbquery("SELECT war_id FROM fusion_war WHERE a_id='".$your_id."' OR d_id='".$target_id."' OR WHERE d_id='".$your_id."' OR a_id='".$target_id."'"); Quote Link to comment Share on other sites More sharing options...
btherl Posted February 27, 2007 Share Posted February 27, 2007 No.. you will need to remove the extra "WHERE". Apart from that it's fine. Are you wanting to check two "AND" conditions with an "OR" between? Rather than all "OR" ? Quote Link to comment Share on other sites More sharing options...
btherl Posted February 27, 2007 Share Posted February 27, 2007 Assuming you want all wars between your_id and target_id: $result = dbquery("SELECT war_id FROM fusion_war WHERE (a_id='".$your_id."' AND d_id='".$target_id."' ) OR ( d_id='".$your_id."' AND a_id='".$target_id."' )"); Quote Link to comment Share on other sites More sharing options...
HaLo2FrEeEk Posted February 27, 2007 Share Posted February 27, 2007 Not that I know of, the proper syntax for a mysql query would be this: $sql = mysql_query('SELECT `war_id` FROM `fusion_war` WHERE `a_id` = \''.$your_id.'\' OR `d_id` = \''.$target_id.'\' OR `d_id` = \''.$your_id.'\' OR `a_id` = \''.$target_id.'\''); You would then parse the result using mysql_result(). Quote Link to comment Share on other sites More sharing options...
TRI0N Posted February 27, 2007 Share Posted February 27, 2007 Well first off you don't need the periods.. $result = dbquery("SELECT war_id FROM fusion_war WHERE (a_id = '$your_id' AND d_id = '$target_id') OR (d_id = '$your_id' AND a_id = '$target_id')"); Quote Link to comment Share on other sites More sharing options...
sandrob57 Posted February 27, 2007 Author Share Posted February 27, 2007 Assuming you want all wars between your_id and target_id: $result = dbquery("SELECT war_id FROM fusion_war WHERE (a_id='".$your_id."' AND d_id='".$target_id."' ) OR ( d_id='".$your_id."' AND a_id='".$target_id."' )"); Thanks, that looks like it will work Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.