make username and userid into array php

Posted by Bharanikumar on Stack Overflow See other posts from Stack Overflow or by Bharanikumar
Published on 2010-03-26T09:20:03Z Indexed on 2010/03/26 9:23 UTC
Read the original article Hit count: 389

Filed under:
|

i want to my array ,

somthing like this manner

array("userid"=>"username","1"=>"ganeshfriends","2"=>"tester")

mysq query somthing 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);

Can you tell me how to make

userid as key and username as val...

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about array