Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Databases _ error in php and mysql

Posted by: jobedsno May 23 2014, 08:24 AM

I have Error: 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 13 and i dont know how and where did i get that wrong

<?php

function retrieve(){
include 'connection.php';
//$result = "SELECT candidate_id, first_name,middle_name,last_name,sex FROM candidates ";

$result = "SELECT
candidates.candidate_id,
education_level,
english_level,
experience_time,
district
FROM candidates
JOIN education_quali ON candidates.candidate_id = education_quali.candidate_id
LEFT JOIN employ_history ON candidates.candidate_id = employ_history.candidate_id
WHERE candidates.candidate_id = (
SELECT candidate_id
FROM candidate_job
WHERE candidate_job.candidate_job = 'sales' ";

$query = mysqli_query($db_connection, $result)
or die("Error: ".mysqli_error($db_connection));

Posted by: jimlongo May 23 2014, 09:44 AM

line 13 in the query is
WHERE candidate_job.candidate_job='sales'

my WAG would be that it should be candidates.candidate_jobs
since I don't see a previous mention of a table called candidate_jobs

Posted by: Kelly008 Apr 1 2015, 05:41 AM

SELECT candidate_id
FROM candidate_job
WHERE candidate_job.candidate_job = 'sales' ";



Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)