Monisha
Monisha

Reputation: 439

Print multidimentional array from query result

I have an array:-

$resolution = array();
foreach ($report as $key => $val) {
    $queryToGetRes = "SELECT resolution,ticket_no FROM techzilla.bugs WHERE bug_id = '$val' ";
    $sqlResult = mysql_query($queryToGetRes) or die (mysql_error());
    while ($resolutionAns = mysql_fetch_array($sqlResult)) {
             $resolution[$resolutionAns['resolution']][] = $resolutionAns['ticket_no'];
    }
  }

I need to print the array which stores the resolution and ticket no.

Upvotes: 0

Views: 42

Answers (2)

George
George

Reputation: 311

try something like this:

echo "<pre>" . print_r($resolution, true) . "</pre>";

Upvotes: 1

Unlink
Unlink

Reputation: 993

For debuging purpuses you should use

var_dump($resolution);

If you want to use it

foreach ($resolution as $r => $ids){
    echo "Resolution : $r\n";
    foreach ($ids as $id) {
        echo "$id\n";
    }
}

Upvotes: 0

Related Questions