Welcome Guest, Not a member yet? Register   Sign In
JSON library
#1

[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?




Theme © iAndrew 2016 - Forum software by © MyBB