0

Hello I am inserting data in MySQL table using codeigniter by following query

$subcat_name="Hellome� testing";
$this->db->insert("table",array("name"=>"$subcat_name");

I am echoing its Equivalent SQL Query is following

INSERT INTO `table` (`name`) VALUES ('Hellome� testing');

Question:

Why data is not inserted in Database while SQL Query is proper?

4
  • try using utf8_encode($subcat_name) before you pass $subcat_name to the insert function Commented Jan 20, 2017 at 9:09
  • @Skalbhile Thanks for reply let me check Commented Jan 20, 2017 at 9:13
  • @Skalbhile It insert data but not properly inserted. It insert something like Hellome testing Commented Jan 20, 2017 at 9:19
  • Make sure that your script is saved with encoding utf_8. and your table collation is utf8_general_ci. For more details read stackoverflow.com/a/8281157/4050077 Commented Jan 20, 2017 at 13:19

1 Answer 1

0

I think you should try using HTML NUMBER of the symbol which you want to instead of using . Go to following link::

http://www.ascii.cl/htmlcodes.htm

and find the symbol you want put the HTML NUMBER of that, i think that will work.

Sign up to request clarification or add additional context in comments.

1 Comment

I am trying to insert Hellome� testing string in Database but not inserted

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.