stuart7398 Posted April 11, 2008 Share Posted April 11, 2008 Hi. When a user adds a telephone number to their profile i want the last 3 digits hidden, when the profile goes online. when a different member has paid for membership then the last 3 digits will appear. 09876 987 *** 09876 987 876 i'm not sure whether this is a php or mysql topic. any help appreciated. Thanks, Stuart. Quote Link to comment Share on other sites More sharing options...
AP81 Posted April 11, 2008 Share Posted April 11, 2008 $sPhone = '09876 987 876' $sSecurePhone = substr($sPhone,0,9) . ' ***' Quote Link to comment Share on other sites More sharing options...
AP81 Posted April 11, 2008 Share Posted April 11, 2008 You could also do it in MySQL like this: SELECT CONCAT(LEFT(PHONE,9), ' ***') FROM tablename Quote Link to comment Share on other sites More sharing options...
stuart7398 Posted April 11, 2008 Author Share Posted April 11, 2008 Hi. Thanks, however i'm still learning both php and mysql. The following gives me the error. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM members CONCAT(LEFT(PHONE,9), ' ***'WHERE member_id = '1'' at line 1 [code ]<?php require '../config.php'; require '../opendb.php'; $data = mysql_query("SELECT CONCAT(LEFT(PHONE,9), ' ***' FROM members WHERE member_id = '$SESS_MEMBER_ID'") OR DIE (mysql_error()); $info = mysql_fetch_array( $data ); { Print "<table style='table-layout:fixed; width:100%' class='up_account'>"; Quote Link to comment Share on other sites More sharing options...
AP81 Posted April 11, 2008 Share Posted April 11, 2008 You are missing a bracket. You need another bracket after the asterisks': SELECT CONCAT(LEFT(PHONE,9), ' ***') Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.