NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL and spaces in data

Jeff jsiegel1 at optonline.net
Thu Jun 19 19:48:01 EDT 2003


The purpose:

If a box is checked it means that the dealer sells parts for that
particular make/model. This data is then used to match a purchaser to a
dealer(s) depending on the user's needs.

Now I *wish* I could say that the makes/models had identifying keys
however...things are worse than that. This data is matched against a
table containing 2.5 million rows (that's right! 2.5 million rows) of
non-normalized data that contains information on most every part for
most every make/model made since about 1952. This data comes from
another source and, therefore, there is nothing that can be done to
normalize the data (it's a L-O-N-G story as to why it can not be
normalized...makes/models are simply text strings within each row).
Consequently, the text is needed because a match is made by matching
text strings.

Not the greatest system, I admit, but sometimes one has to work with
what one is given.

I've tried the str_replace and that seems to have done the trick (at
least in preselecting check boxes based on post data) and I'll use it
again to strip out underscores when I save it to the database.

I'm open to suggestions if you have another idea.

Jeff

-----Original Message-----
From: Analysis & Solutions [mailto:danielc at analysisandsolutions.com] 
Sent: Thursday, June 19, 2003 6:02 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] MySQL and spaces in data


Jeff:

On Thu, Jun 19, 2003 at 05:36:16PM -0400, Jeff wrote:
> Dan,
> 
> Thanks for your input...here's some more info on what I'm doing.
>
> <input name="ALFA-ROMEO|GTV-6" type="checkbox" value="1" checked >
> <input name="ALFA-ROMEO|SPIDER VELOCE" type="checkbox" value="1">
> 
> First part gives me the manufacturer, second part gives me the model.

But what you haven't clarified is the forms actual purpose.  Okay, so,
you're processing the manufacturer and model in the checkboxes.  But
what
does it mean if someone checks the box?  In addition, what other data is
submitted?  What are you doing with all of this data?

Before writing what I just wrote, I started writing the following, so
I'm 
leaving it here to avoid having to restate it later...

You mentioned using a database.  I assume each manufacturer and each
model
are represented by integer based primary keys.  Right?  Again, if you
want
to store both the manufacturer and model ID numbers in the name
attribute
of the name element, do this:

   <input name="cars[5][23]" ... />
   <input name="cars[5][50]" ... />
   <input name="cars[10][2]" ... />

Where the first key is the manufacturer and the second key is the model.


> The post data has underscores.

Which is why I'm saying you should use use a different approach.

--Dan

-- 
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409


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






More information about the talk mailing list