Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2010
    Location
    Oslo, Norway
    Posts
    58
    Thanks
    10
    Thanked 1 Time in 1 Post

    Thumbs up Need help with a achievement script

    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?
    PHP Code:
    <?php 
    session_start
    (); 
    include_once 
    "includes/db_connect.php"
    include_once 
    "includes/functions.php"
    logincheck();
    $username=$_SESSION['username'];
    $query=mysql_query("SELECT * FROM users WHERE username='$username'");
    $fetch=mysql_fetch_object($query);
    $query1=mysql_query("SELECT * FROM user_info WHERE username='$username'");
    $fetch1=mysql_fetch_object($query1);


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

    <body>

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

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Looks like you need to tweak your database design. Do you have a table that stores achievements?

  • #3
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    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
    Rowsdower! has accused me of having mental problems, and the administrator allowed it. What a great forum huh?

  • #4
    New Coder
    Join Date
    Mar 2010
    Location
    Oslo, Norway
    Posts
    58
    Thanks
    10
    Thanked 1 Time in 1 Post
    user_info is the one where i get all the achievement data, but im kinda noob at php so please go more in details


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •