I have two tables, users and jobs. I'm trying to write a query that selects and displays a job a user might want based on their input / information. How can I write this query if the data is in two tables?
I'll be displaying the data in a while loop that creates and information card for each match.
any help is much appreciated.
try {
$sql = $dbh->prepare("SELECT * FROM jobs WHERE users");
if($sql->execute()) {
$sql->setFetchMode(PDO::FETCH_ASSOC);
}
}
catch(Exception $error) {
echo '<p>', $error->getMessage(), '</p>';
}
?>
DB structures: users
user_id` int(5) NOT NULL AUTO_INCREMENT,
`user_name` varchar(25) NOT NULL,
`user_email` varchar(35) NOT NULL,
`user_pass` varchar(255) NOT NULL,
`user_phone` bigint(20) NOT NULL DEFAULT '99',
`user_gender` varchar(20) NOT NULL,
`user_profession` varchar(64) NOT NULL,
`user_min_salary` int(5) NOT NULL,
`user_dob` varchar(10) NOT NULL,
`user_location` varchar(64) NOT NULL,
DB structure jobs:
`vac_id` int(11) NOT NULL AUTO_INCREMENT,
`vac_post_date` varchar(10) NOT NULL,
`vac_deadline` varchar(10) NOT NULL,
`vac_job_title` varchar(64) NOT NULL,
`vac_comp_name` varchar(64) NOT NULL,
`job_description` text NOT NULL,