472,093 Members | 2,510 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,093 software developers and data experts.

Simple MySQL Search from MySQL beginner

Hi,

I'm trying to build a simple search for a database of jobs. Users can
search using three groups of critera:

1) Area (check boxes)

[ ] Buying and merchandising
[ ] Design
[ ] Executive
[ ] Human resources
[ ] Manufacturing
[ ] Retail operations
[ ] Sales and marketing
[ ] Technical
[ ] Visual merchandising

2) Location (dropdown)

All, UK specific, Africa, Asia, Europe, Middle East, Americas, Oceania
3) Keyword (single text box)

I'm currently using the following:

---

$location= $HTTP_GET_VARS['searchlocation'];
$keyword= '%'. $HTTP_GET_VARS['searchkeyword'] . '%';
$bm = $HTTP_GET_VARS['buying_and_merchandising'];
$design = $HTTP_GET_VARS['design'];
$executive = $HTTP_GET_VARS['executive'];
$hr = $HTTP_GET_VARS['human_resources'];
$manufacturing = $HTTP_GET_VARS['manufacturing'];
$ro = $HTTP_GET_VARS['retail_operations'];
$sm = $HTTP_GET_VARS['sales_and_marketing'];
$technical = $HTTP_GET_VARS['technical'];
$vm = $HTTP_GET_VARS['visual_merchandising'];

$query = "SELECT * FROM jobs WHERE location LIKE '$location' AND
description LIKE '$keyword' AND (`buying and merchandising` LIKE '$bm'
OR design LIKE '$design' OR executive LIKE '$executive' OR `human
resources` LIKE '$hr' OR manufacturing LIKE '$manufacturing' OR `retail
operations` LIKE '$ro' OR `sales and marketing` LIKE '$sm' OR technical
LIKE '$technical' OR `visual merchandising` LIKE '$vm' ) ";

$result = @mysql_query ($query);

----

If you pick a location or enter a keyword it works OK, but checking a
check box (the job areas) to narrow the results down doesn't work...

Any ideas on a straightforward MySQL query to solve this would be much
appreciated (I'm quite new to this!).

Thanks,

OP.

Jun 27 '06 #1
0 1501

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Dariusz | last post: by
2 posts views Thread by Mark | last post: by
5 posts views Thread by Alex Glaros | last post: by
67 posts views Thread by Bob Powell | last post: by
2 posts views Thread by Master | last post: by
7 posts views Thread by Ivan Marsh | last post: by
4 posts views Thread by | last post: by
2 posts views Thread by sathyashrayan | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.