oracle259 Posted September 29, 2006 Share Posted September 29, 2006 How can i improve on the following code[code]while ($res = @mysql_fetch_array($result)) { if (stristr(trim($user, $reserved)) { $length = strlen($reserved); for ($k = 1; $k <= $length; $k++) { $percent = "%";}$newuser = eregi_replace($reserved, $percent, trim($user));$percent = " "; } }echo $newuser;[/code]The problem is this, say $user = "bob.camsara and $reserved names are bob and sara the output would be %%%.camsara.Question how can i modify the code to go through the entire result to get %%%.cam%%%%. 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.