then, should i do this?
---
$query = "SELECT * FROM refer ORDER BY hits desc LIMIT $i,$end";
$result = mysql_db_query ("celebzone", $query);

$num = mysql_num_rows($result);
echo $num;

 for ($i; $i < $end; $i++)
   {
        $r = mysql_fetch_array($result,$i);

  $id = $r[id];
  $title = $r[title];

  // $id = mysql_result($result, $i, "id"); // check this later
  // $title = mysql_result($result, $i, "title"); // check this later
      echo "<a
href=\"http://www.celebritieszones.com/jump.php?id=$id\">$title</a><br>\n";

 }
--------------

it didn't work. it says "Warning: Supplied argument is not a valid MySQL
result resource in /home/sites/site3/web/links/index.php on line 15"

why?

""Plutarck"" <[EMAIL PROTECTED]> wrote in message
9bte0p$53d$[EMAIL PROTECTED]">news:9bte0p$53d$[EMAIL PROTECTED]...
> You'll want to use the LIMIT option in SQL. So on the end of your query
add:
>
> "LIMIT 0,10" to get the first ten results.
>
> The first number is the "offset", and the last is the max amount to
> retrieve. To get links 20 through 40 you'd use:
>
> "LIMIT 19, 39"
>
> The offset is refering to an array, so offset 0 is actually the first
link.
>
>
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
>
>
> ""McShen"" <[EMAIL PROTECTED]> wrote in message
> 9btbqt$t79$[EMAIL PROTECTED]">news:9btbqt$t79$[EMAIL PROTECTED]...
> > hi
> >
> > I have 30 links stored in a table(mysql) now. I wanna show them
accorging
> to
> > the traffic they send. But i don't want to list all of them in just 1
page
> > because i will be adding 300 links soon. (I don't want my visitors to
wait
> 3
> > minutes to load the links)How should i do it? I wanna do it like this
> > http://mydomain.com/links?list=0
> > shows only links from 0-15
> > and
> > http://mydomain.com/links?list=15
> > shows links from 15-30
> > etc.
> >
> > here is my code.
> > ------
> > <?php
> >
> > $connection = mysql_connect("localhost","","");
> > if ($connection==false)
> > {
> > echo mysql_errno().":".mysql_error()."";
> > exit;
> > }
> > $query = "SELECT * FROM refer ORDER BY hits desc ";
> > $result = mysql_db_query ("celebzone", $query);
> >
> > $rows = mysql_num_rows($result);
> > $num_of_page = floor($rows/15)+1;
> >
> > $i=$list;
> >
> > for ($i = $list; $i < $list+15; $i++)
> > {
> >
> > if ($i <= $rows)
> > {
> > @$id = mysql_result($result, $i, "id"); // check this later
> > @$title = mysql_result($result, $i, "title"); // check this later
> > echo "<a
>
href=\"http://www.celebritieszones.com/jump.php?id=$id\">$title</a><br>\n";
> >
> > }
> > else
> > {
> > echo "<!-- Cute Celebrities Links -->";
> > $i = 288; // this forces it to quit the loop
> >
> > }
> > }
> > echo "<br>";
> >
> > $check = floor($rows/$num_of_page); // this finds how many pages it
should
> generate
> > if ( $check>0 )
> > {
> >
> > if (($i-1)==288)
> > {
> > echo "<!-- Cute Celebrities Links !-->";
> > }
> > else
> > {
> > $num_of_page = $i;
> > echo "<a
>
href=\"http://www.celebritieszones.com/links/index.php?list=$num_of_page\">N
> ext Link Page</a>";
> > }
> >
> > }
> > ?>
> > -------
> > It's not good though and it's kinda stupid. :( When it loads the last
page
> of my links, it will show this
> > "Warning: Unable to jump to row 48 on MySQL result index 2 in
> /home/sites/site3/web/links/index.php on line 22
> >
> > Warning: Unable to jump to row 48 on MySQL result index 2 in
> /home/sites/site3/web/links/index.php on line 23"
> >
> > You see the @? I am using it to supress the error messasges cuz i don't
> know how to fix this error. Please help. :)
> > Thank You.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to