Jump to content

Recommended Posts

Hi,

 

Small question : I'm using a mysql database running on the MyISAM engine with utf8_general_ci encoding. Now when I put something in my database ( a string perhaps .. ) or read something, do I still need to do some kind of encoding to handle special characters ? Or how is this generally handled ?

Link to comment
https://forums.phpfreaks.com/topic/171448-solved-encoding-content-from-a-database/
Share on other sites

I assume you want to know how to insert "Safe" strings so there is no SQL injection...

 

If I am correct, use mysql_real_escape_string, it looks like this:

 

$name = mysql_real_escape_string($_POST['name']);
mysql_query("INSERT INTO table_name (`name`) VALUES ('$name')");

I assume you want to know how to insert "Safe" strings so there is no SQL injection...

 

If I am correct, use mysql_real_escape_string, it looks like this:

 

$name = mysql_real_escape_string($_POST['name']);
mysql_query("INSERT INTO table_name (`name`) VALUES ('$name')");

 

Hi,

 

Thanks for the information, but considering I'm working with prepared statements when inserting information into the database should I still be using this ?

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.