I have a query in PHP that is like:
$result = $db->prepare("SELECT * FROM table WHERE page_url_match = :pageurlmatch AND datetime(post_time) > datetime('now', '-32 hours')"); # line 124
$result->bindValue(':pageurlmatch', $shorturl, SQLITE3_TEXT); # line 130
I keep getting an error:
[10-Dec-2015 12:20:09 America/New_York] PHP Warning: SQLite3::prepare(): Unable to prepare statement: 1, near "now": syntax error in XXX on line 124
[10-Dec-2015 12:20:09 America/New_York] PHP Fatal error: Call to a member function bindValue() on a non-object in XXX on line 130
How do I have PHP log a specific variable to the error_log file if this error shows up again. I know i can use error_log($var);
but I do not know how to trigger this to only go if there is an error