Reveal
Posted: Thu Dec 03, 2015 10:19 pm
Alright, have another issue I have been trying to tackle for a while now. I have a table called explored_univ. Whenever a player enters a sector it updates this table showing where they been.
Now on my map page, I have a ton of ?'s listed as unexplored space to that player. I have the following code at the top of the page (yes I know, its mysql and not mysqli or PDO)
I have this code where each question mark is located
So the bottom code is to match the sector number, username and explored in the explored_univ table. However all it is doing is pulling the very first record it comes to with that username and explored and not matching the '2', but in the table it shows I have been to sector 2. I cannot figure out why it will not work. Each sector is different and does not always show a "P". The P represents a planet, where "O" is open space, etc. Just at this sector there is a planet. Any suggestions?
Now on my map page, I have a ton of ?'s listed as unexplored space to that player. I have the following code at the top of the page (yes I know, its mysql and not mysqli or PDO)
Code: Select all
$sql_pl = mysql_query("SELECT username, sect_start, sector FROM players WHERE email='$email'");
$sql_pl1 = mysql_fetch_array($sql_pl) or die("Cannot get sector");
$pl_username = $sql_pl1['username'];
$sect_start = $sql_pl1['sect_start'];
$sector = $sql_pl1['sector'];
$sql_map = mysql_query("SELECT sector_id, player_name, explored FROM explored_univ WHERE player_name='$pl_username'");
$sql_map1 = mysql_fetch_array($sql_map) or die("Cannot get info");
$sect_id = $sql_map1['id'];
$map_sect = $sql_map1['sector_id'];
$pl_user = $sql_map1['player_name'];
$map_exp = $sql_map1['explored'];
Code: Select all
if($map_sect == '2' AND $pl_user == $pl_username AND $map_exp == 'Y')
{
echo "P";
} else {
echo "?";
}