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
}
?>

nevermind i figured it out...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.