Web lists-archives.com

Re: How to retrieve next record?




Thanks Martin,

But loading ALL the records sums up to (now) 10 mio records and further on in future up to 100 mio records.
Hmmmm, don't think that's wise.

Nevertheless, thanks for thinking alog.

BR, Hans.





Martin Gainty schreef op 11-12-14 om 23:33:
If you *dont* mind implementing your fetch in PHP:
Get ALL of the records into a resultset
then fetch each record one a time from the resultset e.g.
        if($con != null)
            {   //start $con!=null
                $res = mysqli_query($con, "SELECT *FROM Table"); //we have all records in $res
                if ($res != null)
                {     //check to make sure resultset != null
                   $rowcount = 0;
                   $row=mysqli_fetch_array($res,MYSQLI_ASSOC); //get the first record from the resultset $res
                   while($rowcount < $res->num_rows)
                   {     // start while
                              $row = mysqli_fetch_array($res); //get the NEXT record from the resultset $res
                             $rowcount = $rowcount + 1;
                    }
               } //end res!=null
           } //end $con!=null

Martin Gainty
________________

Date: Thu, 11 Dec 2014 14:07:33 -0800
Subject: Re: How to retrieve next record?
From: mussatto@xxxxxxx
To: larry.martell@xxxxxxxxx
CC: mysql@xxxxxxxxxxxxxxx

On Thu, December 11, 2014 13:43, Larry Martell wrote:
On Thu, Dec 11, 2014 at 4:34 PM, Trianon 33 <trianon33@xxxxxxxxx> wrote:
Hi all,

It seems like a simple question, however I'm not able to find the
answer.....

Let me explain. I have a DB with lots of columns, one is labeled as
'kenteken' and it is also the primary key in the DB. I poke into this DB
with the command

$sDBQuery1 = "SELECT * FROM kentekenlogtest WHERE kenteken =
'$sActueelkenteken'";

This is ok and gives me the correct result. However, then I want the
next
row (according to the primary key), but with what command?

That's were I'm stuck.

Didn't find anything like NEXT, so... what to look for?

What do you mean by 'next' row? Since you're querying by primary key
you will only get one row, right?

Related what is the form of the prmary key.  If its numeric something like
  $sDBQuery1 = "SELECT * FROM kentekenlogtest WHERE kenteken <
'$sActueelkenteken' limit 1"
might work.

------
William R. Mussatto
Systems Engineer
http://www.csz.com
909-920-9154


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

  		 	   		


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql