Im trying to make a dynamic query but my result always comes up blank. I have a page where the form mthod used is POST and i call a second page where I fist make the post into a varible using
<?php
$temp1=$_POST['Name'];
?>
then stick temp1 into a query like below my problem is that LIKE %$temp1% just comes up blank where as if i put the same condition in the LIKE wildcard ill get a answer my query looks as follows.
$sql = 'SELECT `book_id` , `title` , `author1` , `author2` , `subject ` , `publisher ` , `keywords ` '
. ' FROM `greybook_books`.`books` '
. ' WHERE `title` '
. ' LIKE \'% $temp1 %\''
. ' LIMIT 0 , 30';
Does not work but does not throw error either
$sql = 'SELECT `book_id` , `title` , `author1` , `author2` , `subject ` , `publisher ` , `keywords ` '
. ' FROM `greybook_books`.`books` '
. ' WHERE `title` '
. ' LIKE \'% $sams %\''
. ' LIMIT 0 , 30';
works fine but i need it to work with a varible where have i gone wrong