sql query error

LOOKATYOU

Member
May 9, 2011
34
4
Hello,
Okay i never done this kind of codeing before im really new to it
Today i was like really bored, you know when you get that bored you would do just about anything?
Well yeah, that was me, today i decided to try code my own script for ubercms some of them are working, but one is being a little pain in da .. yeh anyway
let me tell you what i want it to do,
i wanted a script so members can see the newest members that registered to the sit, and be able to see the date
what sql code was i useing ?
this
$getTopStats = mysql_query("SELECT * FROM users ORDER BY account_created DESC LIMIT 1");
while($topSpats = mysql_fetch_array($getTopStats)){
echo '<img src=" ' . $topSpats['look'] . '&size=s" align="left"><a href="#">'.$topSpats['username'].'</a><br />account created: '.$topSpats['account_created'].'<br /><br /><br /><br />';
}
but when i go to my page i get

Credits: 15075

i want it to be
registered on: -date-
Any idea how i can do this.
 

Jerry

not rly active lol
Jul 8, 2013
1,957
522
Here is a working code:
PHP:
    <div id="habblet-container" class="column2">
                      
                <div class="habblet-container ">      
                        <div class="cbb clearfix blue ">
  
                            <h2 class="title">Newest User</h2>
                        <div class="habblet-container">
<?php

$getTopStats = mysql_query("SELECT * FROM users ORDER BY account_created DESC LIMIT 1");
while($topSpats = mysql_fetch_array($getTopStats)){
echo '<center><img src="%www%/includes/imager.php?figure=' . $topSpats['look'] . '&size=m" align="left"><a href="#"></center>'.$topSpats['username'].'</a><br />account created: '.$topSpats['account_created'].'<br /><br /><br /><br />';
}
?>
</div></div></div></div>
Screenshot:
B8CKVLs.png
 
Last edited:

LOOKATYOU

Member
May 9, 2011
34
4
Here is a working code:
PHP:
    <div id="habblet-container" class="column2">
                     
                <div class="habblet-container ">     
                        <div class="cbb clearfix blue ">
 
                            <h2 class="title">Newest User</h2>
                        <div class="habblet-container">
<?php

$getTopStats = mysql_query("SELECT * FROM users ORDER BY account_created DESC LIMIT 1");
while($topSpats = mysql_fetch_array($getTopStats)){
echo '<center><img src="%www%/includes/imager.php?figure=' . $topSpats['look'] . '&size=m" align="left"><a href="#"></center>'.$topSpats['username'].'</a><br />account created: '.$topSpats['account_created'].'<br /><br /><br /><br />';
}
?>
</div></div></div></div>
Screenshot:
B8CKVLs.png
Hello thanks for the reply works grate so fair, however, i wanna change it to show more then 1 user, so i changed DESC LIMIT 1"); to DESC LIMIT 4"); but they dont go down in a stright line they go down like
picture1
picture2
picture 3
how can i change it so it will go down stright
like
picture1
picture2
picture3
 

Hepixhotel

Member
Mar 1, 2013
28
8
Oyc99nv.png

If you wanted something like this..


PHP:
<div align="left"> 
<table width="100%">


<tr>
<?php

$userstats_a = mysql_query("SELECT * FROM users ORDER BY id DESC LIMIT 5");
while($userstats = mysql_fetch_assoc($userstats_a)){
$row = mysql_fetch_assoc($row = mysql_query("SELECT * FROM users WHERE id = '".$userstats['id']."' LIMIT 5"));


?>




<tr><td width="5px"> </td>
<td width="20px"><img src="http://www.habbo.nl/habbo-imaging/avatarimage?figure=<?php echo $avatar; echo $row['look']; ?>&size=s&direction=2&head_direction=2&gesture=sml&size=m" align="left"></td>
<td width="195px"><a href="/home/<?php echo $row['username']; ?>"><b><?php echo $row['username']; ?></b></a><br />
<br><?php echo date("D, d F Y - H:i", $row['account_created']); ?></br></td>
</tr>


<?php } ?>
</table>
</div>
 
Last edited:

LOOKATYOU

Member
May 9, 2011
34
4
Oyc99nv.png

If you wanted something like this..


PHP:
<div align="left">
<table width="100%">


<tr>
<?php

$userstats_a = mysql_query("SELECT * FROM users ORDER BY id DESC LIMIT 5");
while($userstats = mysql_fetch_assoc($userstats_a)){
$row = mysql_fetch_assoc($row = mysql_query("SELECT * FROM users WHERE id = '".$userstats['id']."' LIMIT 5"));


?>




<tr><td width="5px"> </td>
<td width="20px"><img src="http://www.habbo.nl/habbo-imaging/avatarimage?figure=<?php echo $avatar; echo $row['look']; ?>&size=s&direction=2&head_direction=2&gesture=sml&size=m" align="left"></td>
<td width="195px"><a href="/home/<?php echo $row['username']; ?>"><b><?php echo $row['username']; ?></b></a><br />
<br><?php echo date("D, d F Y - H:i", $row['account_created']); ?></br></td>
</tr>


<?php } ?>
</table>
</div>
thanks but now i see this
avatarimage



Notice: A non well formed numeric value encountered inC:\xampp\htdocs\includes\tpl\page-creditleader.tpl on line 55
Thu, 01 January 1970 - 01:00
 

Users who are viewing this thread

Top