John Kebbel wrote:
>       For years, I've been using FileMaker Pro to generate a staff photo
> gallery and staff phone directory from the same table of staff
> information. I'm switching to PHP/MySQL for the year ahead. In STEP 1
> below, I concatenate a name for the teacher/staff person image and in
> STEP 3 I concatenate an XHTML table cell for the image and name. Steps 1
> and 3 have been tested and work fine. I don't know how to accomplish
> STEP 2 however. Suppose I start with a last name like De Long or Van
> Schmidt? I wind up with de lonxx.jpg or van scxx.jpg for my image names.
> I have a superstitious dread of putting spaces in Linux/Unix web file
> names. Could someone suggest a way to replace the " " in imgName with
> ""?
>       
> STEP 1: Create the root of the image name
> update staff set imgName = Lower(CONCAT(Left(last,6),Left(first,2)));
>
> STEP 2: 
> How do I delete spaces in the imgName?
>
> STEP 3: 
> update staff set webLine = CONCAT("<td><img src='images/",imgName,".jpg'
> width='100' height='125'><br clear='all' />",first," ",last,"</td>");
>
>       Thanks in advance for your time spent in reading or responding.
>
>
>   
In MySQL itself, check out the Replace() function:
http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_replace

In *nix (and by the way, a space really isn't that big of a deal as
people make it out to), you may want to do a perl script to find and
replace the spaces.

-- 
The NCP Revue -- http://www.ncprevue.com/blog


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

Reply via email to