Virtue 10 Posted July 11, 2013 <html> <head> <title>Event Rewards Log</title> </head> <body><center><font size=16>Prizes given for events!</font><br /><font size=4>Event Reward Logs~</font><br /><br /> <table border='1'> <tr> <td>Character</td> <td>Received</td> <td>Quantity</td> <td>Date</td> <td>From</td> </tr> <?php //------------------------- // By Pancake with the help of #rathena at irc://irc.rathena.net //------------------------- // Connect to database server mysql_connect("127.0.0.1", "User", "Password") or die (mysql_error ()); // Select database mysql_select_db("rathena_rag") or die(mysql_error()); // SQL query $strSQL = "SELECT * FROM itemizer ORDER BY id DESC"; // Execute the query (the recordset $rs contains the result) $rs = mysql_query($strSQL); // Loop the recordset $rs while($row = mysql_fetch_array($rs)) { echo "<tr>"; echo "<td>" . $row['char_name'] . "</td>"; echo "<td>" . $row['item_name'] ."</td>"; echo "<td>" . $row['item_amount'] ."</td>"; echo "<td>" . $row['when'] ."</td>"; echo "<td>" . $row['by_gm'] . "</td>"; echo "</tr>"; } echo "</table>"; // Close the database connection mysql_close(); ?></center> </body> </html> I want to add a pagination for the Index and another query <td>Claimed</td> echo "<td>" . $row['collected'] . "</td>"; But I want it to show Yes or No. if you put the code i just made it just shows 1 or 0 Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted July 11, 2013 For the collected or uncollected items, try this: echo "<td>" . ($row['collected']) ? "Yes":"No" . "</td>"; For pagination, I was never good in PHP but it'd be some GET data with the start of the fetching and the number of rows you'd want to return. I don't remember if that line of code I sent you works, though. Quote Share this post Link to post Share on other sites
0 Virtue 10 Posted July 11, 2013 i'll try that now thanks Quote Share this post Link to post Share on other sites
0 Virtue 10 Posted July 11, 2013 didn't work though Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted July 11, 2013 Does the `collected` row exist in your table? Quote Share this post Link to post Share on other sites
0 hemagx 69 Posted July 12, 2013 Try this if ($row['collected'] == 0){echo "<td>No</td>";}else{echo "<td>Yes</td>";} Quote Share this post Link to post Share on other sites
I want to add a pagination for the Index and another query
But I want it to show Yes or No. if you put the code i just made it just shows 1 or 0
Share this post
Link to post
Share on other sites