simple php Dollar $ evaluation in string questions

Posted by Mirage on Stack Overflow See other posts from Stack Overflow or by Mirage
Published on 2010-06-07T01:11:59Z Indexed on 2010/06/07 1:22 UTC
Read the original article Hit count: 250

Filed under:

I have always been confused that .e,g in php i have sql statement

$qry = "select * from table where id = $id";

now can i insert "$" directly inside the quotes or i have to use

 $qry = "select * from table where id =".$id." ";

or

 $qry = 'select * from table where id = $id';

or

 $qry = 'select * from table where id = '$id'';

Which is correct

© Stack Overflow or respective owner

Related posts about php