How to get an array to check in the in_array function? See description Below...
Posted
by Parth
on Stack Overflow
See other posts from Stack Overflow
or by Parth
Published on 2010-04-27T08:51:15Z
Indexed on
2010/04/27
8:53 UTC
Read the original article
Hit count: 216
I am fetching the data using mysql_fetch_array like :
while($row = mysql_fetch_array($select))
{
$tables[] =$row;
}
Now i need this $tables array as one dimensional array only, so that i can use it in
if(in_array($val['table_name'],$tables))
{
//Some Code
}
to check for whether the $val['table_name'] is in the $tables or not.. As for now I am getting $tables array as
Array
(
[0] => Array
(
[TABLE_NAME] => jos_audittrail
)
[1] => Array
(
[TABLE_NAME] => jos_banner
)
[2] => Array
(
[TABLE_NAME] => jos_bannerclient
)
..
..
..
..
}
But I need the $tables is form of..
Array
(
[0] => jos_audittrail
[TABLE_NAME] => jos_audittrail
[1] => jos_banner
[TABLE_NAME] => jos_banner
[2] => jos_bannerclient
[TABLE_NAME] => jos_bannerclient
..
..
..
}
How can i get the above array after applying "while loop" to "$row"?
© Stack Overflow or respective owner