Possible Duplicate:
Output (echo/print) everything from a PHP Array
I have done a query from a database and the result is stored in a variable which is believe is an array. The output is only one row and column so i use:
echo result[0]; to output the result. However i get an error saying:
Notice: Array to string conversion in "C:/apache/htdocs...." array I tried to dump the variable using
var_dump result[0]; I then get this
array(1) { [0]=> array(1) { ["var_datain"]=> string(4) "hai!" } } So.... how do i get it to echo out the value hai! from that array?
In case it matters, here is my query
$db = new PDO(DSN, DBUSER, DBPASS); $stmt = $db->prepare("CALL test(?)"); $parameter = 'hai!'; $stmt->bindValue(1, $parameter, PDO::PARAM_STR); $rs = $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); var_dump($result);