Here's a var_dump of the query that is failing
string 'INSERT INTO event(name, description, location, image, datetime) VALUES('Nica\'s Weight Loss Class', 'Description goes here!', 'Location', 'Nica's Weight Loss Class.png', '2015-01-01T01:00')' (length=189)`
The error is
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's Weight Loss Class.png', '2015-01-01T01:00')'
And the line of code creating the query string is: (all variables escaped before-hand)
$query = "INSERT INTO event(name, description, location, ".($imageForEvent?"image, ":"")."datetime) VALUES('$evName', '$evDescription', '$evLocation', ".($imageForEvent?"'".basename($imageForEvent)."', ":"")."'$evDatetime')";
According to the mysql docs a backslash character is used to escape single quotes.
However, according How to escape apostrophe (') in MySql?, the correct way seems to be to double the quotation mark.
I've tested both ways and they give the same error in the same place. Can anyone shed some light on this subject?