Re: replace question
| From: | Chris | Date: | Fri, 13 May 2005 05:04:25 +0000 |
| Subject: | Re: replace question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-39430@lists.php.net to get a copy of this message | ||
Chris Payne wrote:
Hi there everyone, I'm pulling some sensitive data from a MySQL DB with PHP and the clients wants the first x amount of numbers displayed on the screen to be xxxxxx etc ... rather than the numbers, but wants the last 6 to be displayed, is there an easy way to do this? I understand this isn't technically a DB question as such, but if someone could point me in the right direction (IE: which function to read up on) I would really appreciate it. Chris Well, it can technically be done in either the query itself or PHP, I prefer to do that sort of thing in the query.Using MySQL I woudl do somehting like: CONCAT('xxxxxxxxxxxxxx',RIGHT(sColumn,6)) I didn't verify the RIGHT function ,but that sort of thing should be possible with any sort of DB server. If I were doing it with PHP, it would be something like $sColumn = 'xxxxxxxxxxxxxx'.substr($sColumn,-6); Chris