I am trying to put together an archive of reviews on my web site. I want the user to be able to click on a link like: http://www.ekkocom.com/fnn/scripts/breviews.php?letter=a And get all the reviews of books or authors that start with the letter A. I get a parse error on this line and I'm not sure why:
$sql = "select breview_name, breview_id, breview_authorlast, breview_authorfirst, breview_date, breview_title from bookreviews where like "a%" order by breview_date desc";
Please help if you can.
i think you need
where breview_title like "%a" or breview_authorlast like "%a"
but i'm not sure
Not too sure if the double quotes would interfere with the parsing of the script, but you might try adding slashes before the quotation marks, so that it passes the information with quotes to SQL rather than trying to interperate the quotes in PHP's own function.
or use single quotes
Your sql string should be like this,
$sql = "select breview_name, breview_id, breview_authorlast, breview_authorfirst, breview_date, breview_title from bookreviews where <b>book_title</b> like \"a%\" order by breview_date desc";
Di
Thanks!! It worked 🙂
yep, worked out great 🙂