php-db | 2001071
Date: 07/01/01
- Next message: Jesse S. Williams: "RE: [PHP-DB] most efficient weighting system? URGENT"
- Previous message: Jesse S. Williams: "[PHP-DB] working with files"
- Next in thread: Aral Balkan: "[PHP-DB] Metabase for sessions"
- Reply: Aral Balkan: "[PHP-DB] Metabase for sessions"
- Maybe reply: Jesse S. Williams: "RE: [PHP-DB] Formatting Strings in MySQL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Is there a certain format you always need the string in? Such as 3 digits
followed by a space followed by 3 digits followed by a space followed by 3
digits? Will there ALWAYS be 9 numbers? If this is the case, your ereg()
to parse the string and then create a new varible using $regs[x]... so, if
the above example IS the case, you could use:
if (ereg("^([0-9]{3})([0-9]{3})([0-9]{3})$", $initialValue, $regs) {
$var = "$regs[1] $regs[2] $regs[3]";
}
This may not be the EXACT code, but it's close... Personally, regexps and I
battle often and they always seem to win *grumble* But this should give
you the idea. Look at:
http://www.phpbuilder.com/columns/dario19990616.php3
or
http://www.php.net/manual/en/function.ereg.php
for more details. The first is a VERY helpful resource for using regs in
PHP. Hope this helps some.
Jesse Williams
System Administrator
DowNET VoIP Team
Electronic Data Systems
-----Original Message-----
From: Artur Correia [mailto:artur.correia <email protected>]
Sent: Saturday, June 30, 2001 12:45 PM
To: php-db <email protected>
Subject: [PHP-DB] Formatting Strings in MySQL
Hey
How can I get a string (or number) from mySQL like "123123123" to
display "123 123 123"??
Tks
I'm kinda rookie
Artur
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Jesse S. Williams: "RE: [PHP-DB] most efficient weighting system? URGENT"
- Previous message: Jesse S. Williams: "[PHP-DB] working with files"
- Next in thread: Aral Balkan: "[PHP-DB] Metabase for sessions"
- Reply: Aral Balkan: "[PHP-DB] Metabase for sessions"
- Maybe reply: Jesse S. Williams: "RE: [PHP-DB] Formatting Strings in MySQL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

