List:General Discussion« Previous MessageNext Message »
From: douglass_davis Date:August 24 2005 4:23am
Subject:Re: Treating Two Fields Like One
View as plain text  

David Blomstrom wrote:

>-- douglass_davis@stripped wrote:
>
>  
>
>>Can
>>you just concatenate 
>>the two strings together after you get them from the
>>database? e.g. 
>>$parent.$name?  And, just split() or explode() the
>>string when you get it from the URL?
>>    
>>
>
>Consider the following URL's:
>
>1. stacks/leo
>
>2. stacks/Panthera_leo
>
>The first is "recognized" by my database and fetches
>information. The second doesn't work. If I concatenate
>then split the link as you suggest, will it produce a
>link that looks like #2 yet is recognized by my
>database?
>
>If so, I'll learn how to do those functions.
>
>  
>
Yes.

The problem here is a PHP one, not an SQL one..   MySql doesn't know 
anything about your links, that's not it's job, but it does know about 
fields. It's PHP's job to know about links and make MySql "recognize" 
the links by formatting them in an appropriate way in the SQL.

in the taxonomic names, replace spaces with '-' (look that up... it's 
one of the PHP string functions)  By the way, I hope the names don't 
have any ' or , in them, if so, you'll need to do more replacing.  
Search for replace on the php site.

Then, concatenate like this:
$parent.'_'.$name 

Add that to the end of your URL.

then when you get the URL parameter 'taxon', explode() it on '_', then 
replace all - with spaces in each of the two values you get. 


>
>Yes, there will definitely be spaces between words. I
>haven't yet decided whether I'll replace them with -,
>_ or . (period). However, I'm leaning towards
>underscores ( _ ) for this particular page and hyphens
>( - ) on a topics page.
>
>T
>

don't use periods. those have other meanings in PHP, and it can get to 
be confusing.

-- 
http://www.douglassdavis.com


Thread
Treating Two Fields Like OneDavid Blomstrom24 Aug
  • Re: Treating Two Fields Like OneEnrique Sanchez Vela24 Aug
  • Re: Treating Two Fields Like Onedouglass_davis24 Aug
    • Re: Treating Two Fields Like OneDavid Blomstrom24 Aug
      • Re: Treating Two Fields Like Onedouglass_davis24 Aug
        • Re: Treating Two Fields Like OneDavid Blomstrom24 Aug
  • Re: Treating Two Fields Like OnePeter Brawley24 Aug
    • Re: Treating Two Fields Like OneDavid Blomstrom24 Aug
    • Re: Treating Two Fields Like OneDavid Blomstrom24 Aug
      • Re: Treating Two Fields Like OneSGreen24 Aug
        • Re: Treating Two Fields Like OneDavid Blomstrom24 Aug
      • Re: Treating Two Fields Like OnePeter Brawley24 Aug
RE: Treating Two Fields Like OneGordon Bruce24 Aug
Re: Treating Two Fields Like OneDavid Blomstrom25 Aug
  • Re: Treating Two Fields Like Onedouglass_davis25 Aug