phpsyntax-errorphp-parse-error

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());

Solution

  • 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());