我有3个表求职者,认证和教育我想用预备语句查询。这是我的代码
$username= $_SESSION['username'];
$query = $pdo->prepare("SELECT jobseeker.username , jobseeker.first_name , jobseeker.last_name , education.university , certification.institution , from jobseeker inner join education on jobseeker.username=education.jobseeker_username inner join certification on jobseeker.username=certification.jobseeker_username where username=:username");
$query->bindParam(':username' , $username);
$query->execute();
$data = $query->fetchAll(PDO::FETCH_ASSOC);
return $data;
它不起作用。
答案 0 :(得分:0)
您的查询出错,请在,
之前删除使查询失败的逗号from jobseeker
。
SELECT jobseeker.username , jobseeker.first_name , jobseeker.last_name , education.university , certification.institution from jobseeker inner join education on jobseeker.username=education.jobseeker_username inner join certification on jobseeker.username=certification.jobseeker_username where username=:username
答案 1 :(得分:0)
查询中的语法错误。
正确查询
SELECT jobseeker.username , jobseeker.first_name , jobseeker.last_name , education.university , certification.institution
From jobseeker
INNER JOIN education
ON
jobseeker.username = education.jobseeker_username
INNER JOIN certification
ON
jobseeker.username = certification.jobseeker_username
where
jobseeker.username = :username