Hi Everyone,
Basically i have a reward system on my website as Achievements. On the acievements page i want to display the achievment images that are unlocked and the locked image if the user has not unlocked them. The following code works but still brings back the following error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/*******/public_html/*******/achievements.php on line 32
And here is the code i am using:
<?php
$selectachievement = mysql_query("SELECT * FROM achievementlist");
while($displayachievement = mysql_fetch_array($selectachievement)) {
$achievement = $displayachievement['achievementName'];
$checkunlocked = mysql_query("SELECT * FROM achievements WHERE achievementName ='$achievement' AND achievementUser = '$currentuser'");
$achievementunlocked = mysql_num_rows($checkunlocked);
?>
<td class="achievement" width="120" achievementname="
<?php echo $displayachievement['achievementName']; ?>">
<img src="<?php if ($achievementunlocked == "1") {
echo $displayachievement['achievementImage']; }
else {
echo "http://clancorner.net/images/achievements/locked.png"; } ?>"></td>
<?php
}
?>
Thanks in advance people!