php array

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
seuntech
Forum Newbie
Posts: 13
Joined: Thu Feb 24, 2011 4:54 pm

php array

Post by seuntech »

please i need your help. i need to output the result below in this format $array = array('45', '92' , '91','94', '90', '12', '104', '105', '93');

Code: Select all

$checkfresult = mysql_query("SELECT name, state FROM users"); $users = array(); while($thecount = mysql_fetch_assoc($checkfresult)){ $users[] = $thecount; };  $array = array('45', '92' , '91','94', '90', '12', '104', '105', '93');
shauns2007
Forum Commoner
Posts: 27
Joined: Wed Feb 02, 2011 11:34 am

Re: php array

Post by shauns2007 »

Add

Code: Select all

print_r($array);
fugix
Forum Contributor
Posts: 207
Joined: Fri Mar 18, 2011 8:01 pm

Re: php array

Post by fugix »

or if you want to display just the values and not the keys you can use a foreach loop
Post Reply