Re: Only showing 20 lines per page...



OK, think I have got it...

I can do the count using select count(id) and the maths to work out the
start and finish.

This is how I think using mysql_fetch_array works...

$conn = //db connection stuff
$sql = "select VALUES from TABLE LIMIT X,X";
$sql1 = "mysql_query($sql,$conn) or die(mysql_error());

while ($results = mysql_fetch_array($sql1)) {
$value1 = $results['value1'];
$value2 = $results['value2'];
.
.
.etc..
//create a display block
echo $value1
echo $value2
.
.
.etc..
}

I think I was confused as I'm used to seeing a counter var incremented
as the check to see when to dump out of the while loop. I couldn't see
how it knew to move to the next row each time. Can you explain?

Thanks

Mike

.



Relevant Pages

  • Re: Only showing 20 lines per page...
    ... I can do the count using select countand the maths to work out ... echo $value1 ... as the check to see when to dump out of the while loop. ... data pointer ahead. ...
    (alt.php)
  • Re: Reading a variable line by line with while loop
    ... done < `echo "$Variable"` ... echo "History - $History" ... The last echo command returns nothing, but if I put an echo command in ... the loop either before, or after the replace spaces command, it echoes ...
    (Ubuntu)
  • Re: 2.6.16-rc4: known regressions
    ... either with a command line argument, or with just the early bootup initrd ... Is there a way to tell the kernel about which is the root device other ... a loop with one second delay. ... echo -n "Waiting for root device to appear" ...
    (Linux-Kernel)
  • Re: [PHP] 2 errors I can not understand
    ... echo is not a function. ... multiple args is probably insignificant, ... and super-long loop... ... function isprime ...
    (php.general)
  • Re: Startup Script but wait for SQL to start
    ... In each case there is supposed to be a Username in the log file. ... @echo off ... if Errorlevel 1 goto Loop ... And it sucessfully starts up the Indexer. ...
    (microsoft.public.windows.server.general)