1

I want to update my sql table , but in my case I am getting error look like this

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ivision '' at line 1

$name = "A'nme";

$this->db->update("users",["name" => $name]);

My project based on Codeigniter

How can I solve this problem ?

Yur Gasparyan
  • 664
  • 5
  • 20
  • 1
    Possible duplicate of [How to insert a value that contains an apostrophe (single quote)?](https://stackoverflow.com/questions/1912095/how-to-insert-a-value-that-contains-an-apostrophe-single-quote) – OLIVER.KOO Jul 07 '17 at 19:46
  • 1
    look up how to escape special characters ( & ' _ % ) in sql – OLIVER.KOO Jul 07 '17 at 19:51

1 Answers1

2

Double up and use single quotes to see it better: How to insert a value that contains an apostrophe (single quote)?

$name = 'A''nme';
Flynn
  • 269
  • 2
  • 12