I want to my array, somthing like this:
array("userid"=>"username","1"=>"ganeshfriends","2"=>"tester")
mysql query something like this:
$query = select username, userid from tbluser
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
$items = array($row['userid']=>$row['username']);
}
print_r($items);
How can I make userid as key and username as val?
Try this:
The problem is that you delete and reassign the result array ($items) in every loop of the while block