It's fairly logical, if you are trying to build a string you need to ensure that the string contains exactly what you and the process expects.
PHP Code:
$test="INSERT INTO Staff (fname, lname, grade, position, awards, id) VALUES('$_POST[fName]','$_POST[lName]','$_POST[grade]','$_POST[position]','$_POST[awards]','')";
$test1='INSERT INTO Staff (fname, lname, grade, position, awards, id) VALUES('$_POST[fName]','$_POST[lName]','$_POST[grade]','$_POST[position]','$_POST[awards]','')';
$test2='INSERT INTO Staff (fname, lname, grade, position, awards, id) VALUES('.$_POST[fName].','.$_POST[lName].','.$_POST[grade].','.$_POST[position].','.$_POST[awards].','.')';
echo($test);
echo($test1);
echo($test2);
In these examples I am trying to build a string to pass to a MYSQL process.
Because the string $test begins and ends with double quotes, with no other double quotes, then the entire contents are considered to be part of the string.
In $test1 it does not consider the entire contents as part of the string, it considers everything between the first single quote and the second as part of the string, it then evaluates the first POST variable and tries to continue with the next string and so on. This will tend to produce a T_VARIABLE.
In $test2 because of the fullstops/periods the string is calculated correctly because each part of the string is being concatenated.
In the above examples $test & $test2 produce the same results.
Sorry if this is as clear as fog, but I hope you get the meaning of the post
Bookmarks