Shadowing Posted August 26, 2012 Share Posted August 26, 2012 made a small example as simpliest as possible. I'm trying to do is only select the row if x is equal to $x but i have to do some math on some columns to see if its equal to little confusing hope someone knows what im trying to do $x = 2; Select id from travel where x = defender_x + defender_y "but only select it if its also equal to $x" Quote Link to comment Share on other sites More sharing options...
Christian F. Posted August 26, 2012 Share Posted August 26, 2012 It's quite easy, just add the second condition with AND between them. Like so: SELECT `id` FROM `travel` WHERE `x` = defender_x + defender_y AND `x` = $x Quote Link to comment Share on other sites More sharing options...
Shadowing Posted August 26, 2012 Author Share Posted August 26, 2012 lol oh ya haha wierd idk why i was making that more complicated then it needed to be haha Thanks ChristianF Quote Link to comment Share on other sites More sharing options...
Christian F. Posted August 26, 2012 Share Posted August 26, 2012 Hehe, some times we just need to think "Gloves". You're welcome, btw. Glad I could be of help. Quote Link to comment Share on other sites More sharing options...
Shadowing Posted August 26, 2012 Author Share Posted August 26, 2012 oh wait a sec i know whats going on now, the way i was doing it was correct. my example was incorrect i did this statement a week ago and looked at it now and thought it was wrong but it is correct if all those columns with the math is equal to the variable $travel3 = "SELECT defender_gbx FROM travel WHERE '".($session_x)."' = CEIL((attacker_gbx + ((defender_gbx - attacker_gbx) * ((UNIX_TIMESTAMP() - sent_time) / (arrived_time - sent_time)))) / 600) AND '".($session_y)."' = CEIL((attacker_gby + ((defender_gby - attacker_gby) * ((UNIX_TIMESTAMP() - sent_time) / (arrived_time - sent_time)))) / 450) AND stance <> 1 AND stance <> 5 AND stealth_tech <= '".($_SESSION['stealth'])."'"; 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.