Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Trying to grab from two db tables to display them with php
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="WanknessHD" data-source="post: 395213" data-attributes="member: 3511"><p>I have a stats page that displays credits/duckets/diamonds/room visits/repects given/recieved/online time etc.. only problem I have is I'm not very educated with php and I dont know how to grab from two tables in my database. I have my credits and duckets and diamonds displayed perfectly, but the rest of them display the amount but not the user associated with them.</p><p></p><p><img src="http://image.prntscr.com/image/571f02290b994d289615ccf963569753.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>The code to display my credits etc:</p><p>[PHP]<?php</p><p> $getstats = mysql_query("SELECT * FROM users ORDER BY vip_points DESC LIMIT 6");</p><p> $oe = 1;</p><p> while ($info = mysql_fetch_array($getstats))</p><p> {</p><p> if ($oe == 2)</p><p> {</p><p> $oe = 1;</p><p> }</p><p> else</p><p> {</p><p> $oe = 2;</p><p> } </p><p> echo '<table width="100%" style="padding: 5px; background-color: ' . (($oe == 2) ? '#fff' : '') . ';"></p><p> <tbody></p><p> <tr></p><p> <td valign="middle" width="25"><img style="margin-top: -10px;" src="http://www.habbo.nl/habbo-imaging/avatarimage?figure=' .$info['look'] . '&direction=3&headonly=1"></td></p><p> <td valign="top"></p><p> <p style="font-size: 90%;"><strong><a ' .$info['username'] . '">' .$info['username'] . '</a></strong><br></i>' . $info['vip_points'] . '</i></p></p><p> </td></tr></tbody></table>';</p><p> }</p><p> ?>[/PHP]</p><p></p><p></p><p>And the code I was using to grab the others (same code just tweaked to show what I have)</p><p>[PHP]<?php</p><p> $getstats = mysql_query("SELECT * FROM user_stats ORDER BY RoomVisits DESC LIMIT 6");</p><p> $oe = 1;</p><p> while ($info = mysql_fetch_array($getstats))</p><p> {</p><p> if ($oe == 2)</p><p> {</p><p> $oe = 1;</p><p> }</p><p> else</p><p> {</p><p> $oe = 2;</p><p> } </p><p> echo '<table width="100%" style="padding: 5px; background-color: ' . (($oe == 2) ? '#fff' : '') . ';"></p><p> <tbody></p><p> <tr></p><p> <td valign="middle" width="25"><img style="margin-top: -10px;" src="http://www.habbo.nl/habbo-imaging/avatarimage?figure=' .$info['look'] . '&direction=3&headonly=1"></td></p><p> <td valign="top"></p><p> <p style="font-size: 90%;"><strong><a ' .$info['username'] . '">' .$info['username'] . '</a></strong><br></i>' . $info['RoomVisits'] . '</i></p></p><p> </td></tr></tbody></table>';</p><p> }</p><p> ?>[/PHP]</p><p></p><p>If anyone is willing to guide me on how to fix this im more than down, not looking for handouts as I would like to know how to fix something like this in the future, so if someone could maybe explain and help thatd be cool. Thanks for your time in advance.</p><p></p><p></p><p>Edit: Im able to call the first three because theyre in the users table associated with the character, for the rest im trying to grab the character so it can be displayed like the others.</p></blockquote><p></p>
[QUOTE="WanknessHD, post: 395213, member: 3511"] I have a stats page that displays credits/duckets/diamonds/room visits/repects given/recieved/online time etc.. only problem I have is I'm not very educated with php and I dont know how to grab from two tables in my database. I have my credits and duckets and diamonds displayed perfectly, but the rest of them display the amount but not the user associated with them. [IMG]http://image.prntscr.com/image/571f02290b994d289615ccf963569753.png[/IMG] The code to display my credits etc: [PHP]<?php $getstats = mysql_query("SELECT * FROM users ORDER BY vip_points DESC LIMIT 6"); $oe = 1; while ($info = mysql_fetch_array($getstats)) { if ($oe == 2) { $oe = 1; } else { $oe = 2; } echo '<table width="100%" style="padding: 5px; background-color: ' . (($oe == 2) ? '#fff' : '') . ';"> <tbody> <tr> <td valign="middle" width="25"><img style="margin-top: -10px;" src="http://www.habbo.nl/habbo-imaging/avatarimage?figure=' .$info['look'] . '&direction=3&headonly=1"></td> <td valign="top"> <p style="font-size: 90%;"><strong><a ' .$info['username'] . '">' .$info['username'] . '</a></strong><br></i>' . $info['vip_points'] . '</i></p> </td></tr></tbody></table>'; } ?>[/PHP] And the code I was using to grab the others (same code just tweaked to show what I have) [PHP]<?php $getstats = mysql_query("SELECT * FROM user_stats ORDER BY RoomVisits DESC LIMIT 6"); $oe = 1; while ($info = mysql_fetch_array($getstats)) { if ($oe == 2) { $oe = 1; } else { $oe = 2; } echo '<table width="100%" style="padding: 5px; background-color: ' . (($oe == 2) ? '#fff' : '') . ';"> <tbody> <tr> <td valign="middle" width="25"><img style="margin-top: -10px;" src="http://www.habbo.nl/habbo-imaging/avatarimage?figure=' .$info['look'] . '&direction=3&headonly=1"></td> <td valign="top"> <p style="font-size: 90%;"><strong><a ' .$info['username'] . '">' .$info['username'] . '</a></strong><br></i>' . $info['RoomVisits'] . '</i></p> </td></tr></tbody></table>'; } ?>[/PHP] If anyone is willing to guide me on how to fix this im more than down, not looking for handouts as I would like to know how to fix something like this in the future, so if someone could maybe explain and help thatd be cool. Thanks for your time in advance. Edit: Im able to call the first three because theyre in the users table associated with the character, for the rest im trying to grab the character so it can be displayed like the others. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Trying to grab from two db tables to display them with php
Top