Jump to content

Archived

This topic is now archived and is closed to further replies.

korrupt_23

Very puzzling...

Recommended Posts

Hmm, well, I\'m really not sure why this coding isn\'t working.. and I\'m usually fair with mySQL.. but.. here goes..

 

Please tell me if you see anything wrong, even the smallest thing wrong in this code. The problem is it doesn\'t LIMIT to 5, only 1...

 


<?

@include("connect2.php");



$sql = "SELECT * FROM clicks ORDER BY \'unique\' DESC LIMIT 5";

$result = mysql_query($sql);

$number = mysql_numrows($result);



$i = 0;



$name = mysql_result($result,$i, "pagename");

$clicks = mysql_result($result,$i, "raw");

$unique = mysql_result($result,$i, "unique");



echo "

<TR>

<TD WIDTH="40%" ALIGN="CENTER">

$name

</TD>

<TD WIDTH="25%" ALIGN="CENTER">

$unique

</TD>

<TD WIDTH="30%" ALIGN="CENTER">

Download

</TD>

</TR>

";

$i++;

?>

 

Anything? Or any ideas? Thanks very much..

Share this post


Link to post
Share on other sites

2 things. try mysql_num_rows ... I always do it that way :S

 

And for LIMIT, you can have 2 numbers. it goes LIMIT x,y

 

x = where you start

y = how many max

 

So for the first 5, go

 

LIMIT 0,5

 

for 10-15

 

LIMIT 10,5

 

etc...

 

Hope you find the problem :)

Share this post


Link to post
Share on other sites

Thanks man, and I do know about the 0,5, but 5 does work the same..

 

And yes, I did get it fixed, but I don\'t know how.. I changed too many things at once :oops:

 

Thanks again for trying man!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.