Re: [MySql] PHP Question
| From: | Folke Ashberg | Date: | Sat, 25 Nov 2000 20:06:38 +0000 |
| Subject: | Re: [MySql] PHP Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27168@lists.php.net to get a copy of this message | ||
Hi!
if ($select_stuff=="datedescr") $order="order by date desc";
elseif ($select_stuff=="name") $order="order by name";
elseif ($select_stuff=="foo") $order="order by foo";
else $order="order by bar";
select * from files $order limit 0,15;
isn't is easy?
regards
Folke
--
Folke Ashberg
Stage Internet Services GmbH
Technical Development
folke@fanstage.de
folke@fanstage.de | Tel: +49 89 454591-77 | Fax: +49 89 454591-71
Kreillerstr. 21 | 81673 Munich | Germany | www.fanstage.de
On Sat, 25 Nov 2000, Matt Lush wrote:
> ok I have a question on MYSQL and a form say when using this to select the db
>
> select * from files order by date desc limit 0,15
>
> That selects from the tables files goes oder by date descending and has a limit of 15 how would
I make it if I had a form below with different info for the select it would use them look below
>
> <select name="select_stuff" size="1">
> <option value="datedesc">by date
> <option value="name">by Name
> <option value="etc">etc
> </select>
>
> so if I had selected by date it would use the select by date and if I clicked by name it would
go by name and beside it there would be another pulldown menu with ascending and descending it so if
I had by name on it could descend or ascend?
>
> Does anyone know if what I should do?
>
>