Jump to content
MakeWebGames

Recommended Posts

Posted
<?php
include 'header.php';
echo "<br /><br />";


$achievements = mysql_query("SELECT * FROM `achievements` ORDER BY `id` ASC");
$count = mysql_num_rows($achievements);


echo "<table width='100%' align='center'><tr>
       <th width='25%' class='contenthead'>Image</th>
       <th width='50%' class='contenthead'>Text</th>
       <th width='25%' class='contenthead'>Completed</th>
       </tr>";

       while($r = mysql_fetch_assoc($achievements))
       {

       $query = '';
       $query = mysql_query("SELECT * FROM `achievement` WHERE `a_id` = {$r['id']} AND `u_id` = ".mysql_real_escape_string($_SESSION['id']));
       if(mysql_num_rows($query) == 1) { $complete = '<font color="green">Finished</font>'; }else { $complete = '<font color="red">No</font>'; }

       $r['text'] = str_replace('[value]', number_format($r['value']), $r['text']);
       echo "<tr>
               <td class='contentcontent' align='center'><img src='".$r['image']."' /></td>
               <td class='contentcontent' align='center'>".$r['text']."</td>
               <td class='contentcontent' align='center'>".$complete."</td>
             </tr>";
       }




echo "</table><br /><br />";
include 'footer.php';
?>

 

A little help/knowledge requested.

Anyone know how to make this achievement page display 6 awards at a time. Then a user click next or back to see the next awards.

Posted

Like a pagination? You can do an SQL statement to select a 6 records between a certain amount say you show IDs 1 to 6 them click next and it will show 7 to 12 and so on :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...