Multiple Selects with different Where conditions
Posted: Sun Jul 19, 2009 1:15 pm
Sorry if this has been posted somewhere around here but I can't seem to find it.
I am trying to grab multiple rows from a table but they all have slightly different conditions.
Its suppose to grab 25 different rows and all their columns data. Each row has 4 columns which has information I need. Basically the where starts from the two set values, cordx and cordy which are columns in the table, and from there all the other rows are collected using slightly different values for the two columns.
Basically its a 5x5 grid map that I want to display with the original cordx and cordy being the centre grid.
Is there a way to get this information in a 2-dimensional array or some other way to make it easier to work with? For example:
echo(" $displayCord[pos1][active] ");
I am trying to grab multiple rows from a table but they all have slightly different conditions.
Code: Select all
$cordQuery = mysql_query(sprintf("SELECT * FROM WORLD_MAP WHERE ((cordx>=$playerCord[cordx]-2 AND cordx>=$playerCord[cordx]+2) AND (cordy>=$playerCord[cordy]-2 AND cordy>=$playerCord[cordy]+2))"),$cxn);
$displayCord = mysql_fetch_array($cordQuery);
Basically its a 5x5 grid map that I want to display with the original cordx and cordy being the centre grid.
Is there a way to get this information in a 2-dimensional array or some other way to make it easier to work with? For example:
echo(" $displayCord[pos1][active] ");