0

Hello everyone!

Okay so i am quite far into my website and suffering a annoying problem. What i want the code to do is to get all the achievements from the table 'achievementsList' and then match the ones that are in there with the ones that the user has. The second table is 'achievements' and that holds all users achievements e.g. ID, achievementUser, achievementNAME. If the user has not unlocked the achievements then the locked image is show, if they are unlocked then it pulls out the achievement image stored in the 'achievementsList' table. Thanks everyone for reading and here is the code i am using at the minute.

<?php
$selectachievement = mysql_query("SELECT * FROM achievementlist");
while($displayachievement = mysql_fetch_array($selectachievement)) {
$achievement = $displayachievement['achievementName'];
$currentuser = $_SESSION['user'];
?>
				
<?
if (mysql_query("SELECT achievementName AND achievementUser FROM achievements WHERE achievementName ='$achievement' AND achievementUser = '$currentuser'")) {
$achievementImage = $displayachievement['achievementImage'];
} else {
$achievementImage = "http://www.clancorner.net/images/achievements/locked.png"; 
}
?>

<td class="achievement" width="120" achievementname="<? echo $displayachievement['achievementName']; ?>"><img src="<?php echo $achievementImage; ?>"></td>
<?php
}
?>

Edited by BlueCharge: n/a

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by BlueCharge
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.