I want to list all username from database if the id exists. That code works fine in database select * from users where id IN (1,2,3,4,5)
.
But in php it doesn't work. My php code is
$sql = "select * from users where id IN (1,2,3,4,5)";
$result = mysql_query($sql);
if ( mysql_num_rows($result) > 0 ) {
$row = mysql_fetch_assoc( $result );
echo $row["username"];
}
This php code only list one user name. I want to list all usernames. Sorry for my bad English. Thanks.