Strange ereg_replace problems

From: Date: Wed, 23 Jan 2002 10:45:59 +0000
Subject: Strange ereg_replace problems
Groups: php.db 
Request: Send a blank email to php-db+get-16086@lists.php.net to get a copy of this message
Hi! I've got a really strange problem with ereg_replace. It appeared sort of out of thin air, just suddenly stopped working, and I didn't even change the code one bit. Here's the code and some debug-output : <? if($go=="next") { if($page < $nr_pages && $page >= 0) { $page++; $with= (($page) * 20).","; echo "replace with: " . $with; $what = (($page-1) * 20).","; echo "replace what: " .$what; $query=ereg_replace($what,$with,$query); ?> and here's what the browser says: with: 0, what: 20, //this query is from the above code, which calls a print_table() -function later query from nav(): SELECT L.Tunnus,N.Nimi,L.ISSN,L.Vuosi,L.Lisätietoja,L.Vuosikerta,L.Numerot,L.Huomautuksia FROM uusi_lehtitaulu L, nimet N WHERE L.Nimi_id=N.id LIMIT 0,20 //this is from the print_table -function query: SELECT L.Tunnus,N.Nimi,L.ISSN,L.Vuosi,L.Lisätietoja,L.Vuosikerta,L.Numerot,L.Huomautuksia FROM uusi_lehtitaulu L, nimet N WHERE L.Nimi_id=N.id LIMIT 0,20 page: 0 nr_pages: 230 Quite all right. Then we hit the Next page -button, and get with: 20, what: 0, query from nav(): SELECT L.Tunnus,N.Nimi,L.ISSN,L.Vuosi,L.Lisätietoja,L.Vuosikerta,L.Numerot,L.Huomautuksia FROM uusi_lehtitaulu L, nimet N WHERE L.Nimi_id=N.id LIMIT 20,20 query: SELECT L.Tunnus,N.Nimi,L.ISSN,L.Vuosi,L.Lisätietoja,L.Vuosikerta,L.Numerot,L.Huomautuksia FROM uusi_lehtitaulu L, nimet N WHERE L.Nimi_id=N.id LIMIT 20,20 page: 1 nr_pages: 230 Looking good. Then Next page again, and we end up with... a smack in the face: with: 40, what: 20, query from nav(): SELECT L.Tunnus,N.Nimi,L.ISSN,L.Vuosi,L.Lisätietoja,L.Vuosikerta,L.Numerot,L.Huomautuksia FROM uusi_lehtitaulu L, nimet N WHERE L.Nimi_id=N.id LIMIT 0,20 query: SELECT L.Tunnus,N.Nimi,L.ISSN,L.Vuosi,L.Lisätietoja,L.Vuosikerta,L.Numerot,L.Huomautuksia FROM uusi_lehtitaulu L, nimet N WHERE L.Nimi_id=N.id LIMIT 0,20 page: 2 nr_pages: 230 Note the LIMIT 0,20 here. I'm getting a bit annoyed over this "feature". Anyone have any ideas? Cheers, Markus -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library markus.lervik@vaasa.fi +358-6-325 3589 / +358-40-832 6709

« previous php.db (#16086) next »