Array
(
[1] => Array
(
[id] => 2
[menu_name] => php
[type] => 2
[visible] => 1
)
guyz i have this array as output ...i want to change the code so that when i type id =2 the array should be
[2] =id
{
[menu_name] => php
[type] => 2
[visible] => 1
)
it should fetch from id =2 and give me the output ..please hlp sort of urgent
the code is <?php
$rs = mysql_query("select * from subject",$connection);
while( $ds = mysql_fetch_assoc($rs) )
{
$arrList[] = $ds;
}
echo '<pre>';
echo $arrList[2]['id'];///exit;
print_r($arrList);exit
/// help
php array help
Moderator: General Moderators
Re: php array help
Code: Select all
while ($ds = mysql_fetch_assoc($rs))
{
$arrList[$ds['id']] = array('menu_name' => $ds['menu_name'], 'type' => $ds['type'], 'visible' => $ds['visible']);
}