NewcastleFan Posted April 21, 2012 Share Posted April 21, 2012 Hey Guys, I'm struggling with some logic of how to do something wondering if anyone can point me in the right direction. Details: I am making a PHP/MySQL game to learn more PHP, I've got my login/logout system created. However I am planning on the game been map based on a 100x100 grid. I have two tables: USERS Username, Password, x, y Test, Test, 1, 1 MAP X, Y, type 0,1,1 0,2,1 0,3,2 0,4,3 0,5,2 etc I am stuck on how to get the user's logged in X and Y coordinates and then compare them with the map table X and Y, to see what type of field to show, 1,2 or 3. Is there a name for this type of function so I can do some research on it? Or could someone give me an example? Would be fantastic if anyone has any advice. Thanks in advance NewcastleFan Quote Link to comment https://forums.phpfreaks.com/topic/261360-pulling-data-from-two-tables-compare-and-output/ Share on other sites More sharing options...
freelance84 Posted April 21, 2012 Share Posted April 21, 2012 Just SELECT and WHERE will be able to get the "type" if you have x and y mysql_query("SELECT type FROM maps WHERE x='$x' AND y='$y'"); Quote Link to comment https://forums.phpfreaks.com/topic/261360-pulling-data-from-two-tables-compare-and-output/#findComment-1339276 Share on other sites More sharing options...
NewcastleFan Posted April 21, 2012 Author Share Posted April 21, 2012 Ah, so pull X and Y from user table, then put the X,Y from user into $x and $y then do a second select from map table and display type. Thank you ill give this ago! Quote Link to comment https://forums.phpfreaks.com/topic/261360-pulling-data-from-two-tables-compare-and-output/#findComment-1339279 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.