I've noticed that some people are posting sql queries like

$sql = "select * from mytable where name = '{$name}'";

where i would have put:

$sql = "select * from mytable where name = '$name'";

Mine works so what does the {} add to the statement?

    if you happen to use a reserved word as a variable, the braces indicate that it is indeed a variable.

    like if I had this:
    $sql = "select * from mytable where name = '{$class}'";

    it would work okay, whereas this:

    $sql = "select * from mytable where name = '$class'";

    would fail since class is a reserved word.

      Write a Reply...