List:General Discussion« Previous MessageNext Message »
From:David Blomstrom Date:August 26 2005 5:32am
Subject:Storing underscores ( _ ) in database tables
View as plain text  
(Sorry if this is a repeat; I think my first post
didn't go through.)

I'm still stuck on the problem I asked about a day or
two ago. I'm working on a page at
http://www.geozoo.org/stacks/ that draws data from a
table that lists animal taxons (orders, families,
species, etc.) in a child-parent relationship.

It works exactly the way it should. Try
http://www.geozoo.org/stacks/Animalia, watching the
navigation links and the column on the right, for
example. The problem is that the children of genera -
species - are properly displayed as TWO WORDS - the
child (species) and parent (genus).

http://www.geozoo.org/stacks/Canis illustrates the
problem I run into when I tweak my PHP so that Canis
lupus is displayed instead of just lupus, for example.
If you click Canis lupus or type in
http://www.geozoo.org/stacks/Canis_lupus, you get a
404 Page Not Found Error.

I want it to work like this page:

http://animaldiversity.ummz.umich.e...anis_lupus.html

Notice that the parent displays with just one
variable:

http://animaldiversity.ummz.umich.e...tion/Canis.html

But I don't think I'm ever going to figure this out
until I encounter someone who already has a similar
script up and running. In the meantime, I had another
idea. Suppose I create a new table field that lists
the full species name, including an underscore.

For example, genera and species look something like
this in my current table:

NAME | PARENT
Canis | Canidae
lupus | Canis
Panthera | Felidae
leo | Panthera
Home | Pongidae
sapiens | Homo

My new table might look like this:

NEWNAME | NAME | PARENT
Canis | Canis | Canidae
Canis_lupus | lupus | Canis
Panthera | Panthera | Felidae
Panthera_leo | leo | Panthera
Homo | Homo | Pongidae
Homo_sapiens | sapiens | Homo

So instead of displaying Parent + Name (Homo sapiens)
and adding an underscore, I just display NewName
(Homo_sapiens).

I'm just wondering if there's anything I need to know
about using underscores in database tables. I assume I
can manipulate the underscore with PHP and/or Apache
mod_rewrite, if necessary.

Thanks.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Thread
Storing underscores ( _ ) in database tablesDavid Blomstrom26 Aug
  • Re: Storing underscores ( _ ) in database tablesJasper Bryant-Greene26 Aug
  • Re: Storing underscores ( _ ) in database tablesSGreen26 Aug
    • Re: Storing underscores ( _ ) in database tablesDavid Blomstrom26 Aug