Jump to content

Mysql Usernames in an array?


whiteboikyle

Recommended Posts

Well i was trying to put all the usernames i get from the mysql query into an array.. Here is what i got so far.. but it doesn't work.. Any suggestions?

$result = $config->query("SELECT * FROM members limit 20");
for ($i = 0; $i < mysql_num_rows($result); $i = $i + 1)
	{
	$name = mysql_result($result, $i, "username");
              $id = mysql_result($result, $i, "id");
	$username = array($name => $id);
	}
	echo $username['whitey'];

 

Link to comment
https://forums.phpfreaks.com/topic/110696-mysql-usernames-in-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.