Bravat Posted February 6, 2011 Share Posted February 6, 2011 I have stored a text into DB with HTML tag. Is it possible to read it from DB and display in browser as tagged? Exemple of text: <p> O nama<br /> Iza Online prodaje guma stoji grupa mladih ljudi čiji je cilj da Vam omogući da na što jednostavniji način dođete do Vama potrebnih proizvoda. Za početak smo se odlučili za gume najpoznatijih svetskih proizvođača. U perspektivi nam je proširenje asortimana proizvoda na prateću opremu, auto-kozmetiku i sve ostalo što ide uz vašeg metalnog ljubimca.</p> <p> </p> <p> </p> <table cellpadding="2" cellspacing="2" width="100%"> <tbody> <tr> <td width="32%"> Naziv firme:</td> <td width="68%"> <img alt="" height="25" src="http://localhost/GumeOnline/image/data/petrovicLogo.jpg" width="194" /></td> </tr> <tr> <td> Poslovno sedište:</td> <td> Sutjeska 64, Pirot, Srbija</td> </tr> <tr> <td> Delatnost:</td> <td> Trgovina na malo posredstvom pošte ili preko interneta</td> </tr> <tr> <td> Šifra delatnosti:</td> <td> 4791</td> </tr> <tr> <td> Matični broj:</td> <td> 62244089</td> </tr> <tr> <td> PIB:</td> <td> 106760742</td> </tr> <tr> <td> Br. računa:</td> <td> INTESA 160-341869-50</td> </tr> <tr> <td> Web adresa:</td> <td> <a href="http://www.gumeonline.co.rs/">www.gumeonline.co.rs</a></td> </tr> <tr> <td> Kontakt telefon:</td> <td> 0616860008</td> </tr> <tr> <td> Kontakt e-mail adresa:</td> <td> <a href="mailto:info@gumeonline.co.rs">nfo@gumeonline.co.rs</a><br /> <a href="mailto:komercijala@gumeonline.co.rs">komercijala@gumeonline.co.rs</a></td> </tr> </tbody> </table> <p> </p> <table cellpadding="2" cellspacing="2" width="100%"> </table> <p> Za sva pitanja i sugestije kontaktirajte nas putem mail-a na<br /> info@gumeonline.co.rs</p> Quote Link to comment https://forums.phpfreaks.com/topic/226877-getting-html-out-of-db/ Share on other sites More sharing options...
denno020 Posted February 6, 2011 Share Posted February 6, 2011 Do you know SQL? Do you know how to run a query to grab the contents of a table cell in a database? I'm pretty sure that if you grab that code and display it on a html page, then it's not going to be written as HTML code, it's going to be written as normal text. That means, the web page will actually show HTML code.. Sounds very confusing, but for the browser to interpret that as HTML code, and therefore add styling for the paragraph element, then you need to store <p> in the database, and not <p> Denno Quote Link to comment https://forums.phpfreaks.com/topic/226877-getting-html-out-of-db/#findComment-1170625 Share on other sites More sharing options...
floridaflatlander Posted February 6, 2011 Share Posted February 6, 2011 This is interesting, I always thought the browser would render the page to make the table above but I cut and pasted the html in a file and looked at it in my browser and nothing happened (it looked the same). Isn't this a bit like safe html, does the server format the code before sending it to the browser ? I tried a space, in the same page and it worked fine. Quote Link to comment https://forums.phpfreaks.com/topic/226877-getting-html-out-of-db/#findComment-1170631 Share on other sites More sharing options...
Pikachu2000 Posted February 7, 2011 Share Posted February 7, 2011 html_entity_decode htmlspecialchars_decode Quote Link to comment https://forums.phpfreaks.com/topic/226877-getting-html-out-of-db/#findComment-1170845 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.