mysql语法有问题,我相信语法是正确的虽然我不断收到错误但是当我运行我的网站时出现语法错误
$query = "SELECT DISTINCT paycheck.jobId
FROM paycheck,users
WHERE users.email = " . $_SESSION['email'] .
"AND userId = empId";
答案 0 :(得分:5)
$query = "SELECT DISTINCT paycheck.jobId
FROM paycheck,users
WHERE users.email = '" . $_SESSION['email'] ."' AND userId = empId";
答案 1 :(得分:0)
试试这个:
$query = "SELECT DISTINCT `paycheck`.`jobId`
FROM `paycheck`,`users`
WHERE `users`.`email` = '" . $_SESSION['email'] ."' AND `userId` = 'empId' ";
您也可以考虑转义查询以防止sql注入