creating a seach script for MySQL Db
Posted: Sun Feb 01, 2009 12:30 am
Salutations, php technorati. I hope the new year is going well for you. Ok, I have a new mysql dilemma.
I need to retrieve data from a mysql table based on search criteria. then I want to grab the corresponding Ids
from another table to retrieve more data which will be posted on a search results page. Hence, I am getting information from 1 table and then retrieving corresponding information from another table, ID is primary key. Here is the code:
Am I at least on the right track?
Please enlighten this novice.
Thanks in advance,
Batoe
I need to retrieve data from a mysql table based on search criteria. then I want to grab the corresponding Ids
from another table to retrieve more data which will be posted on a search results page. Hence, I am getting information from 1 table and then retrieving corresponding information from another table, ID is primary key. Here is the code:
Code: Select all
//[color=#4040FF]search input[/color]
$query = "SELECT * FROM js_profile WHERE category = '$category' && degree = '$degree' && years_exp = '$years_exp' && work_time = '$work_time' && available = '$available'";
$result = mysql_query($query) or die(mysql_error());
//[color=#FF0000]how do I get all IDs from above query to retrieve corresponding ID from the table below?[/color]
query = "SELECT * FROM js_resume WHERE ???"
Please enlighten this novice.
Thanks in advance,
Batoe