Re: session_registered variable problem
| From: | Jason Wong | Date: | Mon, 28 Jan 2002 15:34:02 +0000 |
| Subject: | Re: session_registered variable problem | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-16248@lists.php.net to get a copy of this message | ||
On Monday 28 January 2002 21:05, Markus Lervik wrote:
> On Monday 28 January 2002 14:57, Jason Wong wrote:
> > > Somehow when I print the value of $query, it looks fine.
> > > Then, when I change $query a bit and print it again,
> > > it looks fine.
> > > Change it a third time, and it suddenly gets the value it
> > > had in the beginning.
> >
> > Could you post some code please?
>
> Well, for instance, this screws up the $query. It works if one clicks
> once on the next-button, but clicking another time resets the query to
>
> SELECT
> L.Tunnus,N.Nimi,L.ISSN,L.Vuosi,L.Lisätietoja,L.Vuosikerta,L.Numerot,L.Huom
>autuksia FROM uusi_lehtitaulu L, nimet N
> WHERE (L.Nimi_id=N.id AND N.Nimi LIKE "asdf")
> LIMIT 0,20
>
> if($go=="next") {
> if($page < $nr_pages && $page >= 0) {
> $page++;
> $replace_with= (($page) * 20).",";
> echo "replace_with: " . $replace_with;
> $replace = (($page-1) * 20).",";
> echo "replace: " .$replace;
> $query=ereg_replace($replace,$replace_with,$query);
> }
> }
>
> It's the LIMIT 0,20 -> LIMIT 20,20 -> LIMIT 40,20 that doesn't work.
> Strange thing is, that it worked about a week ago. : \
> I can't really recall changing that part of the code at all at that point.
Crikey, it looks terribly complicated for what looks like something to page
through a set of results.
Wouldn't it be easier to do away with the ereg_replace()?
if($go=="next") {
if($page < $nr_pages && $page >= 0) {
$page++;
$start = $page * 20;
}
}
$qry = "SELECT
L.Tunnus,N.Nimi,L.ISSN,L.Vuosi,L.Lisätietoja,L.Vuosikerta,L.Numerot,L.Huom
autuksia FROM uusi_lehtitaulu L, nimet N
WHERE (L.Nimi_id=N.id AND N.Nimi LIKE "asdf")
LIMIT $start,20"
Even it this doesn't work, at least it's easier to understand :)
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
The way to love anything is to realize that it might be lost.
*/