I am using query for joomla.
$query = "INSERT INTO '#__demo'( 'id', 'fname', 'mname', 'lname' ) VALUES ( '$val', '$post['fname']', '$post['Mname']', '$post['Lname']' );";
It is giving error
syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
There are two mistakes on your query.
You haven’t escaped your quotes in
$_POSTvalues.You are using single quotes
'to represent tables and field names.Now after removing all such problems. You query becomes: