I whant to displey list of usernames but in that list must not be listed that username which is looking on this list.
I cnow how to get the list but i am stuck whit the other part...
php code- need help
Moderator: General Moderators
Re: php code- need help
I would set up a $_SESSION['username'] and tell the query to grab all of the usernames except the $_SESSION['username']
Re: php code- need help
Please mabe you can show some example. I am realy new in coding.
Re: php code- need help
well you said that you know how to get the list...so show me that code
Re: php code- need help
Some like this
This code i will mode and add it in form and each user will be like value for radio type input, thats why i don't whant that user who looking on this list can see him self(seleckt him self in my form).
Code: Select all
<?php
$db = mysql_connect('....','.....','.....') or die();
mysql_select_db('....', $db);
$result = mysql_query("set names 'utf8'");
$query = "select * from users username";
$result = mysql_query($query);
$userrow = mysql_fetch_array( $result );
echo "User name list-<br>";
while($userrow = mysql_fetch_array($result)){
$username=$userrow['username'];
echo $username;
echo "<br>";
}
?>Re: php code- need help
so what you are going to do is set up a session with the persons username, so when they login a session with their username is stored...then you are going to edit this line of code
Code: Select all
$query = "select * from users WHERE username != $_SESSION['username'] ";