View Full Version : Need help with a achievement script

03-16-2010, 05:29 PM
Ok, my problem is when the user gets 10+ "credits" the image change to completed. But when he uses all his "credits" then the completed turns into incomlplete again, how can i make it stay completed when the achievement is completed?

include_once "includes/db_connect.php";
include_once "includes/functions.php";
$query=mysql_query("SELECT * FROM users WHERE username='$username'");
$query1=mysql_query("SELECT * FROM user_info WHERE username='$username'");

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="includes/in.css" rel="stylesheet" type="text/css">


<td><span><b>Currently Holding Over 10 Credits</b></span></td>
<td><span><b>Currently holding 10 or more </b></span></td>
<? if ($fetch->credits >= "10"){ ?>
<img src="images/complete.png"><? }else{ ?><img src="images/incomplete.png"><? } ?>

Suggestions? :)

03-16-2010, 06:10 PM
Looks like you need to tweak your database design. Do you have a table that stores achievements?

03-16-2010, 06:18 PM
What is $fetch1 and $query1 used for?

It's a good idea to use <?php instead of <? because sometimes it confuses the language and messes up. It's always better to use <?php

03-16-2010, 06:38 PM
user_info is the one where i get all the achievement data, but im kinda noob at php so please go more in details :)