drisate Posted September 10, 2008 Share Posted September 10, 2008 hey guys I have a problem 1:113:13 - The first number called 'G' can not exeed 9 - The seconde called 'S' can not exeed 499 - The third called 'P' can not exeed 15 So if you add 4P to the obove coord it would now be 1:114:2 I need to be able to select 50S range from an sql query How can i make a script that would select everything inside a range of 50S in a MYSQL table where G, S and P are seperated Link to comment https://forums.phpfreaks.com/topic/123672-need-a-php-guru-for-complicated-coord-manipulation/ Share on other sites More sharing options...
sasa Posted September 10, 2008 Share Posted September 10, 2008 [code]somethin like this <?php $test ='1:113:13'; $add = '50S'; $test = explode(':',$test); $number = ($test[0]-1)*499*15+($test[1]-1)*15+($test[2]-1); $t = substr($add, -1); switch ($t){ case 'G': $add *= 499; case 'S': $add *= 15; case 'P' : $add *= 1; } $new_number = $number+$add; $sql = "SELECT * FROM table_name WHERE ((G-1)*499*15+(S-1)*15+P-1) BETWEEN $number AND $new_number"; ?>[/code] Link to comment https://forums.phpfreaks.com/topic/123672-need-a-php-guru-for-complicated-coord-manipulation/#findComment-638692 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.