How to escape quotes when inserting into database with PHP

前端 未结 4 604
闹比i
闹比i 2021-01-12 07:22

I\'m quite new to PHP so sorry if sounds such an easy problem... :)

I\'m having an error message when inserting content which contains quotes into my db. here\'s wha

4条回答
  •  天命终不由人
    2021-01-12 07:33

    it should work without the sprintf stuff

    $title = mysql_real_escape_string($_POST[title]);
    $body = mysql_real_escape_string($_POST[body]);
    

提交回复
热议问题