I use Api PDO and using fetchAll() returns multidimensional size; This snippet below is just a test case; I just want to know if this is possible.
$LeUsername = "BravoSlayer"; $sth = $dbh->prepare("SELECT * FROM users WHERE Username='$LeUsername'"); $sth->execute(); $result = $sth->fetchAll(); print_r($result); $ArraySearch = search_array($result, $LeUsername);
The output is as follows:
Array ( [0] => Array ( [ID] => 1 [0] => 1 [Username] => bravoslayer [1] => bravoslayer [Password] => thisisatest [2] => thisisatest ) )
I want to search through a multidimensional array in order to return the key. In this case, it will be 0, so I can just bind another variable variable for $ Array1 = $ Array1 ['0'], so from this I can do:
$Username = $Array1['Username'];
user1902584
source share