You are here: Re: Problem displaying a mysql database field « PHP Programming Language « IT news, forums, messages
Re: Problem displaying a mysql database field

Posted by Juliette on 06/21/06 00:54

donpro wrote:
> Hi,
>
> I have a varchar field in a MySQL database that contains a line of text
> like so:
>
> "This is a line if text"
>
> The double quotes are included in the database field.
>
> I cannot seem to display it on my HTML page, it always shows as blank.
> I have tried using both the stripslashes() and the html_entity_decode()
> but it still shows as blank.
>
> An code example I am trying is as follows:
> <?php
> echo
> stripslashes(html_entity_decode($my_variable_from_a_mysql_database));
> ?>
>
> How can I display this please???
>
> Tks,
> Don
>


Hmm.. my first intuition is to ask: are you sure the quotes are in the
database ? (i.e. they haven't been removed when inserting)
Have you looked at the database through phpMyAdmin or any such tool ?

Test what you *really* get back from the database query to make sure you
actually get the string properly from the database by doing a:
print_r($query_result);

If the quotes are there, try this for displaying:
print htmlentities(stripslashes($my_variable_from_a_mysql_database),
ENT_QUOTES);

Good luck,
Juliette

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация