I am currently working on a bit of code to retrieve information from a mysql server through php to be used in an android application using JSON. Unfortunately it appears i am running into errors within my PHP script`
mysql_connect("xxx","xxx","xxx"); // edited out details
$sql=mysql_query("select FName,LName from TEST where UserId=‘".$_REQUEST['userId']."‘");
System.out(331): Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a2275354/public_html/test.php on line 4
First of all you are open to SQL injection, it would be wise to learn about escaping your variables in SQL queries
mysql_escape_string() will probably help you here.
And to the main issue:
"select FName,LName from TEST where UserId=‘".$_RUEST['userId']."‘"
"select FName,LName from TEST where UserId='".$_REQUEST['userId']."'"
Notice the differences in the characters enveloping the
It seems you copied the query from an RTF document of sorts so instead of
' you wrote