Re: Outputting a string from mysql database
| From: | jeff | Date: | Mon, 22 Apr 2002 01:12:59 +0000 |
| Subject: | Re: Outputting a string from mysql database | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13217@lists.php.net to get a copy of this message | ||
J B's Supermarket is correct and it was inserted into tthe database without
using a form and php.
"Mike Flynn" <mike@mikeflynn.net> wrote in message
news:5.1.0.14.2.20020416101040.00a74b70@mikeflynn.net...
> 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/ - mike@mikeflynn.net
> home=>work=>home=>store=>home [repeat daily]
>