On Mon, 21 Jun 2004, David Blomstrom wrote:

> Suppose I have a field with the names of states,
> linked to their home pages:
> 
> <a href="http://www.alabama.gov/";>Alabama</a>
> <a href="http://access.wa.gov/";>Washington</a>
> 
> If I display this on a webpage, I'll get the names of
> the states, linked to their home pages. But is there a
> simple strategy that will let me to display the names
> UNLINKED on another page, or do I have to create a
> second field that lists simple state names, with no
> URL's?

Doing the way you're suggesting would create some problems:

- data redundancy (<a href="http:// and </a> on every field)
- storing two different information on a single field (state name and URL)
- the MySQL index would be filled with at least 8 bytes of useless data 
(a href="), wasting more disk space
- no database-friendly way to search for states or even to sort them by 
name

Separate data from how it's displayed. I mean, create a table called 
"states" with the fields "state_id", "state_name" and "state_url". Put 
the data in the according field:

state_id state_name state_url
1 Alabama http://www.alabama.gov
2 Washington http://access.wa.gov
...and so on

Then you can easily list only state names (ordered by state_name, for 
example), not showing the URL.

[]s,
Salvi.

> 
> Thanks.
> 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to