Page 1 of 1

php array

Posted: Sat Apr 23, 2011 6:43 am
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');

Re: php array

Posted: Sat Apr 23, 2011 10:30 am
by shauns2007
Add

Code: Select all

print_r($array);

Re: php array

Posted: Sat Apr 23, 2011 11:46 am
by fugix
or if you want to display just the values and not the keys you can use a foreach loop