Mysql search query!
Posted: Sun Feb 08, 2009 7:52 am
Greetings php technorati, I am working on a specific query that seaches out specific criteria listed in my database. The data that is being queried exists in two tables of the same database and I need it to return data even if all of the query input is not met. let me know if I am on the right track. Here is the code query:
note: image_name is in the second table
Search results will be echoed on the same page! Anyone have any input? No pun intended.
Thanks in advance!
Batoe
Code: Select all
$query = "SELECT category, degree, years_exp, work_time, available, image_name FROM js_db1
INNER JOIN js_db2 ON js_db2.candidateID = js_db1.candidateID WHERE category = '$category'
&& degree = '$degree' && years_exp = '$years_exp' && work_time = '$work_time' && available = '$available'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_assoc($result))
{
{$row['candidateID']}.
{$row['category']} .
{$row['degree']} ;
{$row['years_exp']}
{$row['work_time']}
{$row['available']}
{$row['image_name']}
}
Search results will be echoed on the same page! Anyone have any input? No pun intended.
Thanks in advance!
Batoe