MySQl错误#1064语法错误

时间:2014-02-10 13:16:58

标签: php mysql sql

我收到此错误:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4 SQL=SELECT company.contactname AS name, company.contactemail AS email, job.title, job.sendemail FROM `kecobo_js_job_companies` AS company JOIN `kecobo_js_job_jobs` AS job ON job.companyid = company.id WHERE job.id =

使用此查询:

$jobquery = "SELECT company.contactname AS name, company.contactemail AS email, job.title, job.sendemail 
            FROM `#__js_job_companies` AS company
            JOIN `#__js_job_jobs` AS job ON job.companyid = company.id  
            WHERE job.id = ".$jobid;

是否有人建议可能出现的问题?

2 个答案:

答案 0 :(得分:1)

$jobquery = "SELECT company.contactname AS name, company.contactemail AS email, job.title, job.sendemail 
            FROM `#__js_job_companies` AS company
            JOIN `#__js_job_jobs` AS job ON job.companyid = company.id  
            WHERE job.id = '".$jobid."'";

考虑注射剂量

答案 1 :(得分:1)

考虑使用MySQLi或PDO。至于您的问题$jobid是空的,您可以在查询中以等号结尾查看。