JSON library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: JSON library (/showthread.php?tid=8695) |
JSON library - El Forum - 05-27-2008 [eluser]Nial[/eluser] I'm using the JSON library found on the CI wiki, but I've run into a problem. When a user posts a news article, I take all of the data and convert it into JSON, which I then store in my database: Code: $content = $this->json->encode(array($user_id, $content, $type, $timestamp)); This works fine unless the $content string contains a quotation mark ('). I'm guessing this is because JSON uses them to separate data. Here's the error I get: Quote:Call to a member function load() on a non-object in system/database/DB_driver.php If I remove the json->encode call, and just store the $content as standard text, everything is peachy. I tried a few things to remedy the problem, including running $content through: htmlentities and addslashes, all to no avail. Any suggestions? |