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."'"); Link to comment https://forums.phpfreaks.com/topic/40312-solved-would-this-work/ 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" ? Link to comment https://forums.phpfreaks.com/topic/40312-solved-would-this-work/#findComment-195033 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."' )"); Link to comment https://forums.phpfreaks.com/topic/40312-solved-would-this-work/#findComment-195036 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(). Link to comment https://forums.phpfreaks.com/topic/40312-solved-would-this-work/#findComment-195037 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')"); Link to comment https://forums.phpfreaks.com/topic/40312-solved-would-this-work/#findComment-195039 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 Link to comment https://forums.phpfreaks.com/topic/40312-solved-would-this-work/#findComment-195040 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.