Re: Appending records
| From: | John McKown | Date: | Fri, 01 Sep 2000 19:37:19 +0000 |
| Subject: | Re: Appending records | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2573@lists.php.net to get a copy of this message | ||
I understand better from your off-line reply to me. You need to add a
period to the end of a field in a mysql database if the field does not
already have a period at the end. I installed mysql 2.23.23-1 on my RedHat
system. The following will do the update.
UPDATE table SET field=CONCAT(field,".") WHERE field REGEXP ".*[^\.]$";
If you have more than one field which requires this, then do each field
individually in separate UPDATE commands.
This is really a MySQL question, not a PHP question. But I hope this gets
you going and helps others.
John
On Fri, 1 Sep 2000, John McKown wrote:
> Well, I don't really know what you mean by "records", but if the record is
> in a string variable, you should be able to something like:
>
> if ("." != substr($string,-1))
> $string.="."
>
>
> On Fri, 1 Sep 2000, GVerron wrote:
>
> >
> > Does someone has a command to check that records end up with a ',' and if
> > not, add one?
> > --
> > Gerard Verron
> >
> >
> >
> >
>
>
>