Depending on how the data was inserted. If the data was inserted via a php
script, then trying to insert data with a single quote ( ' ) in it would
throw an error and the query wouldn't complete. The entire query would fail.

If you want to insert ' in a database, either use escape the ' with a \' ..
which, if the data was submitted through a form via php, the ' are escaped
with slashes by default. So, when you bring up that data from the database
to display, you can use the php function stripSlashes() to remove that
backslash. You could use the addSlash() funciton if you are adding data that
wasn't necessary submittted through a form to escape that single quote. You
can also replace the ' (and double) quotes with their ascii equivalents.

Just some tips I thought I might share.

Good luck,
--
-----
Nicole Amashta
Web Application Developer
www.aeontrek.com
"Mike Flynn" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Are you sure that that last field truly contains "J B's Supermarket" in
the
> database?  Are you sure the error wasn't produced while INSERTING the data
> into the database, thus resulting in only "J B" being put into the
> database?  You should view your database data directly, like by using a
> webmin utility.  If you do $row_info = mysql_fetch_row($result), and then
> show the row with the company name, a single quote (') shouldn't mess it
> up.  But single quotes can mess up a query.  Because if you think about
> your query, if you do it like this:
> INSERT INTO table (Name) VALUES ('J B's Supermarket')
> you can see how the single quote in the Name is messing up the query for
> MySQL -- it's making MySQL think it's the end of the value for Name.  You
> need to escape single quotes when inserting them into a MySQL database.
If
> you do it via a form and have magicquotes turned on in your PHP.INI, then
> it's done automatically.  Otherwise, you have to do it yourself.
>
> At 05:15 AM 4/16/2002 -0400, q wrote:
> >I have a field in a mysql table called table which is called names.
> >Examples of the information in this column :
> >
> >
> >    Name
> >
> >Lottery Company
> >Mark MiniMark
> >J B's Supermarket
> >
> >
> >I connect to the datbase successful and I use the following php line to
> >get the information from the row: $row_info=mysql_fetch_row($result)
> >
> >Howevere when I try to output J B's Supermarket to the web page all I get
> >is J B. How can I get the entire display on the screen including the ' in
> >the name?
> >quincy
>
>
> Mike Flynn - Burlington, VT
> http://www.mikeflynn.net/ - [EMAIL PROTECTED]
> home=>work=>home=>store=>home [repeat daily]
>





-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to