phpmysqlarraysmysqliphp-mysqlidb

PHP--an Array in an Array? Not sure, using ajilion MySQLidb Class need to get value of raw Query


(PHP newb here--can read code somewhat well, working on writing)

I think I have an array in an array. using this for MySQL calls:

https://github.com/ajillion/PHP-MySQLi-Database-Class

my call:

$params = array($mta_name);
$mta_uid = $db->rawQuery("SELECT mta_uid FROM mtas WHERE mta_name = ?", $params);
echo print_r($mta_uid);

ends up with this:

Array ( [0] => Array ( [mta_uid] => 1 ) ) 1

I just want the '1' . Have tried mta_name['0'] and ['1'] and ['0']['1'] / ['1']['0'] / ['1']['2'] etc.

Whenever I have issues always find you guys and usually solves. First time posting.

Many thanks!


Solution

  • This should work

    echo $mta_name[0]['uid'];
    

    The inner array has named elements, not simple number indexed.