If I write something like
$var = 12;
echo '$var'; //$var gets printed
echo "$var"; //12 gets printed
But when I do something like
$name = 'peter'; $email = 'peter@yahoo.com';
$query = "INSERT INTO email_list (name, email) VALUES ('$name', '$email')";
Why are the values of the variables getting inserted in the table? Why do '$name' and '$email' not get inserted into the table, since they are enclosed inside single quotes?
Similarly,
echo 'i am going <br />';
is not printing: i am going <br />
`. You probably don't see the `
` because it is rendered as HTML by the browser. Change the `Content-type` header to `text/plain` or escape the angle brackets if you want `
` to appear on the page lexically. – crush Jan 10 '14 at 20:42