I have this simple PHP/MYSQL prepare statement:
$DBH->prepare("SELECT * FROM books '.($_POST['author'] ? '' : '').'
WHERE id = '1'");
The ternary operator above leads to a syntax error. The error is related to using the post variable $_POST['author']
.
I tried changing it to:
$_POST[\'author\']
$_POST[\"author\"]
$_POST["author"]
All of the above didn't work.
$_POST['author']
? A number? ATRUE
/FALSE
? – Dan Aug 2 at 16:46