I have a PHP page opened directly from a URL with params in it:
http://subdomain.domain.com/phppage.php?id=123456
The PHP page is supposed to execute a very simple SQL statement to retrieve a single data row based on the id variable. The SQL execution is done this way:
$id = $_REQUEST['id'];
$sql = "SELECT * FROM INCIDENTS WHERE ((INCIDENTS.ID) = $id);";
$result = mysql_query($sql);
if(!$result){
die("Error: ".mysql_error());
}
I have run the statement directly on the database via phpMyAdmin (substituting "$id" for an actual number) and it returns the expected record.
When executing the PHP page, however I get this error:
Error: Unknown column '123456' in 'where clause'
I don't understand why it is doing this. Please help!