CodeIgniter Forums
Cannot get image path from the database table - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forum-6.html)
+--- Forum: Issues (https://forum.codeigniter.com/forum-19.html)
+--- Thread: Cannot get image path from the database table (/thread-689.html)



Cannot get image path from the database table - Thamaraiselvam - 01-06-2015

[attachment=67][attachment=68][attachment=69]i have stored image path in the database but i cannot retrieve it using query if i do i'm getting nothing .

here i have attched the images of database table and my coding the output !
please help me

and one more issue ,
i'm having data like <p>sss<img src="path" /></p> this in table but while retrieving I'm getting only the sss , (CANNOT WE RETRIEVE ANY HTML TAGS FROM THE DATABASE ?)


RE: Cannot get image path from the database table - _this - 01-06-2015

Hello Thamaraiselvam,

I had the same problem when getting a xml string from database in one of my projects, the problem is that CI is escaping a lot of characters like "<" or ">" and others which appears in markup tags.

The only way to avoid values to be escape is to use the query() method from Database Class instead of Active Record methods.

So your code should look like this :

PHP Code:
$query $this->db->query("SELECT * FROM data");

foreach(
$query->result() as $row)
    
print_r($row); 

It should solve your problem, if not feel free to ask again Smile

Good luck !


RE: Cannot get image path from the database table - Avenirer - 01-06-2015

Make sure you don't have xss_filter activated in the config file. Also try saving with htmlspecialchars() http://stackoverflow.com/questions/16506259/codeigniter-storing-html-in-database-not-working