I want to transform my query into a more readable shape
I want to know that what difference does it makes if I use a
MySQL Query in this way:
$query3 = "update users set mykey='".$val2."' where userid='$val3'";
Or this way:
$query3 = "update users set mykey='$val2' where userid='$val3'";
Or this way
$query3 = "update users set mykey=$val2 where userid=$val3 ";
I am pretty sure that If I’ll use the last method the values which contain spaces will result in an error. But what about the 1st and 2nd?
Help will
This comes down to personal preference, but I find the following would be the easiest to read:
This is merely due to syntax highlighting in my IDE by showing strings and variables in a different format.