Re: replace question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux