On Monday 28 January 2002 17:34, Jason Wong wrote:
>
> 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 :)
Well, in this particular case it won't work at all, because the SQL-query is
dynamically
created based on what the user wants to search for. It doesn't nessecary include all
columns. The only static bit of the query is "FROM uusi_lehtitaulu L, nimet N" and
"WHERE (L.Nimi_id=N.id" : ) It would be just as big a mess with a truckload of
concatenations, like
$query = "SELECT " . $tables . " FROM uusi_lehtitaulu L, nimet N WHERE
(L.nimi_id=N.id" . $search . ") LIMIT $start,20";
Besides, I have a strange fetisch to do everything the hard way. : )
Cheers,
Markus
--
Markus Lervik
Linux-administrator with a kungfoo grip
Vaasa City Library - Regional Library
[EMAIL PROTECTED]
+358-6-325 3589 / +358-40-832 6709
--
PHP Database 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]