ariel
ariel

Reputation: 3072

Unknown Column error for

I checked everything but given my less than 1 month using PHP i can't seem to get to the bottom of this. Whenever i use this $sql query it gives me the error:

//$startrow is variable
$startrow = 0;

$sql = "SELECT `accounts.full_name`, `image.name` FROM `accounts` LEFT JOIN 
`image` ON `accounts.person_id` = `image.person_id` WHERE 
`accounts.image_set` = '$yes' and `accounts.full_name` LIKE '%$q%' 
LIMIT $startrow, 15";

Upvotes: 0

Views: 34

Answers (1)

Mark Byers
Mark Byers

Reputation: 838156

You don't have a table called image. Your table is called face_shot.

Also, your backticks must surround each part of the name (not the including dot). Or you can omit the backticks completely except for reserved words.

SELECT `accounts`.`full_name`, `image`.`name`
FROM `accounts`
LEFT JOIN `image` ON `accounts`.`person_id` = `image`.`person_id`
WHERE `accounts`.`image_set` = '$yes'
AND `accounts`.`full_name` LIKE '%$q%' 
LIMIT $startrow, 15

Upvotes: 2

Related Questions