SQlite query wildcard and OR are not working
I'm creating a calibre library page since its default one takes ages to
load and query. I want to find an author in the authors table like this:
$db->query("SELECT id FROM authors WHERE name LIKE '%$pal%'")
But when $pal is only "hesse" the result is: "Jacques Chessex" but no
"herman hesse". If I change the query to this:
$db->query("SELECT id FROM authors WHERE name LIKE '%$pal'")
and search for "hesse" it finds "herman hesse" without problems. I tried
to use the 'or' operator like this:
$db->query("SELECT id FROM authors WHERE name LIKE '%$pal' OR name LIKE
'%$pal%'")
but only the first LIKE seems to be used. I'm using PHP5.3 in an Ubuntu
server machine. Queries work fine in general but for these problems. Any
help would be very appreciated.
Thank you
No comments:
Post a Comment