From: "Shiloh Madsen" <[EMAIL PROTECTED]>

I have several tables with long numbers whose digits are always in some
multiple of 8 eg 00000000 or 0000000000000000 etc...up to 160 digits long.
The numbers all have a number of digits that is some multiple of 8. What I
need to do is write an sql update query that will insert a - or some other
seperator character every 8 digits in cases where the number of digits is
higher than 8 i.e. 00000000-00000000, and so on for bigger numbers. What
query would i use to do this?

Since this is a PHP list...

$formatted_number = preg_replace('/([0-9]{8})/','\1-',$number);

although that leaves a - character on the end to strip off. I'm sure there are other ways.

If you want a query to do this, then other than being off topic, it'd help if you told us what database you are using. Not everyone uses MySQL...

---John Holmes...

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to