Jump to content

Very puzzling...


korrupt_23

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..

Link to comment
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 :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

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.