Re: [PHP4BETA] Search listing..
| From: | David Robley | Date: | Mon, 21 Feb 2000 00:07:28 +0000 |
| Subject: | Re: [PHP4BETA] Search listing.. | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-10542@lists.php.net to get a copy of this message | ||
On 20 Feb, Absm wrote:
> Need assistance please;
>
> Require the html form to search a mysql table, for many different photos.
> The photo filenames have been uploaded into a column called photo_name. The
> image been copied to the server. Each photo has a unique id No. that
> auto_increments.
>
> The input name =foto_name which corresponds with the column in the table.
> The problem is i dont wish to specify a particular value. Whats needed is a
> listing of all filenames under the foto_name column, not just one filename.
>
> <input type="checkbox" name="foto_name" value=" " checked>
>
>
> $result = mysql_query ("SELECT * FROM test WHERE
> country_residence like '%'
> AND country_residence like '$country_residence'
> AND (to_days(now())-to_days(dob))/365 >'$min_age'
> AND (to_days(now())-to_days(dob))/365 <'$max_age'
> AND current_date - period < '$past_ads'
> AND foto_name like '$foto_name';
>
>
>
>
> Any corrections or suggestions for the php script???
>
> much appreciated
Two possibilities come to mind:
1) Test whether the box is checked - if so, set $foto-name to the mysql
wild card
2) Test whether the box is checked - if so, leave off the "AND foto_name
like '$foto_name'" from your query.
Cheers
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA