NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL and spaces in data

tom at supertom.com tom at supertom.com
Thu Jun 19 11:14:57 EDT 2003


Ok, gotcha.  PHP is turning the name of the checkbox from ALFA-ROMEO|1600
DUETTO SPIDER to ALFA-ROMEO 1600 DUETTO SPIDER.  If you need to do it this
way, before you do the insert, I would just do a str_replace() on the
string, swapping underscores for spaces.  MySQL certainly doesn't have an
issue storing data with spaces.

Nice car, by the way. :-)



-----Original Message-----
From: Jeff [mailto:jsiegel1 at optonline.net]
Sent: Thursday, June 19, 2003 11:12 AM
To: NYPHP Talk
Subject: RE: [nycphp-talk] MySQL and spaces in data


I'm creating check boxes on the fly. Here's a sample of the output on
the form:

<input name="ALFA-ROMEO|1600 DUETTO SPIDER" type="checkbox" value="1">

Now here's the post data:
[ALFA-ROMEO|1600_DUETTO_SPIDER]

Jeff

-----Original Message-----
From: tom at supertom.com [mailto:tom at supertom.com]
Sent: Thursday, June 19, 2003 9:58 AM
To: NYPHP Talk
Subject: RE: [nycphp-talk] MySQL and spaces in data


Jeff,

What does your insert query look like, and what type of column are you
inserting into?  I can't yet see why this would happen (spaces replaced
with
underscores).

Tom



-----Original Message-----
From: Jeff [mailto:jsiegel1 at optonline.net]
Sent: Thursday, June 19, 2003 10:50 AM
To: NYPHP Talk
Subject: [nycphp-talk] MySQL and spaces in data


How does MySQL handle the following?

I'm trying to save a car model called "1600 DUETTO SPIDER."
I noticed it saves it with underscores.

What happens when I retrieve that data in a query? Does it come back as
1600_DUETTO_SPIDER?
Or, if I need to retain the spaces, do I do something like %20 or
something like &nbsp; when I save the data?

Jeff














--- Unsubscribe at http://nyphp.org/list/ ---





More information about the talk mailing list