creating a seach script for MySQL Db

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
cap2cap10
Forum Contributor
Posts: 158
Joined: Mon Apr 14, 2008 11:06 pm

creating a seach script for MySQL Db

Post by cap2cap10 »

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:

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 ???"
 
Am I at least on the right track?
Please enlighten this novice.

Thanks in advance,

Batoe
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: creating a seach script for MySQL Db

Post by jaoudestudios »

What is the foreign key?
Post Reply