Scusa se ti rompo ancora,ma funziona anche sul multidimensionale?
Ho letto solo ora e quindi cercando un po' su internet ho messo insieme questo:
Codice PHP:
<?php
require_once ('admin/dbi.php');

if(isset(
$_POST['act']) && $_POST['act']=='getbook'){

    
$book=normalize_str(htmlentities(preg_replace('/\s+/','',$_POST['book']),ENT_QUOTES));
    
$filecat='../books/'.$book.'.txt';
    
$catlist=file($filecatFILE_IGNORE_NEW_LINES FILE_SKIP_EMPTY_LINES);
    
    
$query='SELECT `title`,`price`,`image`,`description`,`category` FROM papier_book WHERE book="$book" ORDER BY category ASC, position ASC, title ASC';
    if (
$result $mysqli->query($query)) {
        
$i=0;
        
$rit=new Object();
        while (
$row $result->fetch_assoc()) {
            
$rit[$i]['title']=$row['title'];
            
$rit[$i]['price']=$row['price'];
            
$rit[$i]['image']=$row['image'];
            
$rit[$i]['description']=$row['description'];
            
$rit[$i]['category']=$row['category'];
            
$i++;
        }
        
$result->free();
        
$count=count($catlist);
        for(
$i=0;$i<$count;$i++){
            
$ret=array_merge($ret,search($rit,'category',$catlist[$i]));
        }
        echo 
json_encode($ret);
    }
    else
        echo 
"Error: ".$mysqli->error;
}

function 
search($array$key$value)
{
    
$results = array();
    if (
is_array($array))
    {
        if (isset(
$array[$key]) && $array[$key] == $value)
            
$results[] = $array;
        foreach (
$array as $subarray)
            
$results array_merge($resultssearch($subarray$key$value));
    }
    return 
$results;
}
?>