I searched a lot but unable to find any question which is related to my problem so I posted this one.
I came to know that this following 3 line do the same work.
$q="insert into employee values('".$e."','".$nm."','".$desg."','".$sal."')";
$q="insert into employee values('$e','$nm','$desg','$sal')";
$q="insert into employee values('{$e}','{$nm}','{$desg}','{$sal}')";
$e, $name, &desg, &sal are variables.
I'm confused which one is best and why these 3 working same. 1st one is totally clear to me that it substitutes the variables with value and creates the query.
But in the 2nd and 3rd, its not clear to me how variables are substituted. That is from where I'm learning they says that if I insert a variable into a echo then it should be enclosed with {} or concatenated.
ex: echo "This is {$name}" / echo "This is ".$name;
So I'm confused.