|
Posted by Geoff Berrow on 12/17/56 11:53
Message-ID: <1153390889.552937.42770@p79g2000cwp.googlegroups.com> from
tallalex85@gmail.com contained the following:
>
>I'm trying to design a very basic php script which displays the
>contents of the table, then I want to enable the user to filter out
>certain results. So I went about writing a MySQL query something like
>.....WHERE gender="$gender" AND group="$group" and then wrote a
>form which sets the variables $gender and $group. Now is there a way of
>setting $gender and $group to something that would display the whole
>table?
>
>And is this the right way of going about this? Or is there a better
>way... Infact does anyone know of a good site that might guide me in
>creating such a script?
If you want to do this you'd probably be better of using the keyword
LIKE and the wildcard (%) instead of the = sign alone
for instance
WHERE gender LIKE "$gender%"
would match 'male' if you input 'm', 'ma', 'mal' or 'male'
If it doesn't contain anything you would get all records.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Navigation:
[Reply to this message]
|