Jump to content

Recommended Posts

I've run into a situation now, didn't seem to have it before I switched hosting companies, but words with apostrophes won't insert from text boxes or fields into tables that are text, medium text, longtext and varchar.  Non apostrophe words still do. I've been using the following and still won't insert.

 

<?php
$n_desc=addslashes(htmlspecialchars($_POST['n_desc']));
//or
$n_desc=addslashes($_POST['n_desc']);
//or
$n_date = mysql_real_escape_string ($_POST['n_date']);
?>

 

Nothing works,

 

Anyone run into this or have any solutions.

Thanks,

 

Link to comment
https://forums.phpfreaks.com/topic/156049-words-with-apostrophe-wont-insert/
Share on other sites

Avoid using addslashes for database entries. There is a reason mysql_real_escape_string was created.

 

<?php
$n_desc=mysql_real_escape_string(htmlspecialchars($_POST['n_desc']));

 

Should be all you have to do. Adding slashes should not be used as this there is a function designed for this specific event.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.