search users by begining of their user name

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Milan
Forum Commoner
Posts: 97
Joined: Wed May 17, 2006 6:08 pm

search users by begining of their user name

Post by Milan »

if i have a table "USERS" and a filed "username" how could a display for example all users starting with "S" or "smi" for example?
could i just put WHERE username =S*

thanks.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Code: Select all

<?php
$sql = "SELECT * FROM USERS WHERE username LIKE 'S%'";
?>
Post Reply