I recently updated PHP to 5.4 and I'm starting to get some errors on some old, existing code. I have content I'd like to update in MySQL like so:
It was therefore extremely fitting that the trip also included the release of 'Bunny', a juvenile
The code I have used to work:
$upsql = "UPDATE webpg_tbl SET txt = '$_POST[txt]' WHERE id='$_POST[modify]'";
I thought it may be a syntax issue, I added the double quote and "." into the query like so:
$upsql = "UPDATE webpg_tbl SET txt = '".$_POST[txt]."' WHERE id='".$_POST[modify]."'";
But when the query is executed:
$result = mysql_query($upsql) or print mysql_error() ;
I get:
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 'Bunny', a juvenile green turtle rescued on the 4t' at line 3
I am pretty confident it's the quotes causing the issue. Is there something in PHP I can use to make it accept quotes? I'm aware the code I'm working with is outdated. But due to time/budget constraints. I'm forced to just make it work for the time being.