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_dec ode()
but it still shows as blank.
An code example I am trying is as follows:
<?php
echo
stripslashes(ht ml_entity_decod e($my_variable_ from_a_mysql_da tabase));
?>
How can I display this please???
Tks,
Don 2 1673
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_dec ode() but it still shows as blank.
An code example I am trying is as follows: <?php echo stripslashes(ht ml_entity_decod e($my_variable_ from_a_mysql_da tabase)); ?>
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(st ripslashes($my_ variable_from_a _mysql_database ),
ENT_QUOTES);
Good luck,
Juliette
On or about 6/20/2006 8:54 PM, it came to pass that Juliette wrote: 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_dec ode() but it still shows as blank.
An code example I am trying is as follows: <?php echo stripslashes(ht ml_entity_decod e($my_variable_ from_a_mysql_da tabase)); ?>
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(st ripslashes($my_ variable_from_a _mysql_database ), ENT_QUOTES);
Good luck, Juliette
Suggest checking if magic quotes is on before doing a stripslashes
Here's how I handle comments on my site. It allows for the preservation
of both quote characters(sing le and double) and honors newlines
converting them to <br />
When storing the data:
if (get_magic_quot es_gpc())
{
$a = stripslashes ($_POST[Pre_Comments]);
$a = htmlspecialchar s($a, ENT_QUOTES);
}
else
$a = htmlspecialchar s($a, ENT_QUOTES);
On the HTML text generation after getting info from the database
nl2br($i[Pre_Comments]) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mosher |
last post by:
Hi all,
I have an issue with php and/or mysql. I have a php form that writes "items"
to a mysql database, including a description of the item. On the mysql
server, "magic_quotes_gpc" is ON.
I am testing it now by putting special characters in the description field,
this is what I am entering:
O'Leary "special edition"
|
by: Dariusz |
last post by:
Below is part of a code I have for a database. While the database table is
created correctly (if it doesn't exist), and data is input correctly into
the database when executed, I have a problem when reading out the data into
the PHP variables / array.
It should be displaying the information out in the following way, using
the PHP array:
n_date, n_headline, n_summarytext, n_fulltext
|
by: junglist |
last post by:
Hi guys,
I've been trying to implement an editable datagrid and i have been
succesful up to the point where i can update my datagrid row by row.
However what used to happen was that once i updated one row, all of
them were updated so i immediatelly figured out that i have to include
the id of every entry in the update statement. This is where the
problem is raised. My database is an Access database. The table i am
updating contains a Date...
|
by: yoshitha |
last post by:
hi
db : sql server 2000
lan : C#.net(ASp.Net)
in my database table there are 2 fileds of data type datatime.
in field 1 i'm storing date
in field 2 i'm storing time.
|
by: Brave |
last post by:
I'm hoping someone can help me with a small issue.
I have an asp page that displays informaton from an Access database.
I want to create a form that allows users to display only data that
matches their search criteria.
I have made many forms like this in Front Page with the Database
results wizard, but I want to manually code it.
Here is the code I use to display the data from a database.
| |
by: David W. Fenton |
last post by:
I've been struggling the last two days with something I thought was
very easy, which is to open a web page with a form on it and
populate the form with data passed in a query string (either POST or
GET).
I got Application.FollowHyperlink *kind* of working, but was having
problem with double encoding of some characters (I had to do special
things with + signs in the data, as well as never figuring out why
some data was getting...
|
by: Atli |
last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users.
Anyone should be able to get through this without much trouble. Programming knowledge is not required.
Index
What is SQL?
Why MySQL?
Installing MySQL.
Using the MySQL command line interface
|
by: xtremebass |
last post by:
Hi ,
i have created table with only one field for the type of varchar(8000) . I am stroed bulk amount of data in that field.
The size i have specified is enough for the field to occupy my data.
I am storing "Text file" as Data to that filed.when i am viewing contents present in the table it shows what actual contents present in that text file like one by one line of data.
But when i am reterving the data in the browser using Jsp,...
|
by: xtremebass |
last post by:
Hi ,
i have created table with only one field for the type of varchar(8000) . I am stroed bulk amount of data in that field.
The size i have specified is enough for the field to occupy my data.
I am storing "Text file" as Data to that filed.when i am viewing contents present in the table it shows what actual contents present in that text file like one by one line of data.
But when i am reterving the data in the browser using Jsp,...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |