Hmm... I don't really see how your code works.... You don't provide an image...
file_exists("/pathtoimagefolder")){
maybe you forgot to append $bkimage to /pathtoimagefolder ?
anyway, I'll assume that's what you meant.
Your message is quite ambigous... when do you want the select? Are you supposed to select all books first, and then work out whether they have images or not? or do you all ready have a list of books, and you want to select * for which of those books don't have images?
since the_Igel provided the later, here's a solution to the former:
There is a PHP function that checks whether files exist or not. (file_exists) Why not just use a loop to loop through all the books, and check wheather their respective image files exist. If they don't add them to an array. (if that's what you meant by list)
Er, you can't actually use file_exists in your sql query though. I think that's what you wanted to do wasn't it? Just use a query like this:
select bookid, image from books;
and then a while loop or something to loop through each row returned and to check each image with file_exists. if doesn't exist then add the book id to an array... or similar.
hope that helps
-Adam 🙂