Thursday 28 April 2016

How to detect a syntax error in PHP?





I have got a PHP syntax error called




Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\playit2\rental_list.php on line 189





The line 189 is



$jsql_ae3 = mysql_query("select products.formats from products where products.id='$jrowa2['id']'") or die(mysql_error());

Answer



With arrays and functions, you need to put curley braces:



$jsql_ae3 = mysql_query("select products.formats from products where products.id='{$jrowa2['id']}'") or die(mysql_error());


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...