Codice PHP:
$book=normalize_str(htmlentities(preg_replace('/\s+/',' ',$_POST['book']),ENT_QUOTES,'UTF-8'));$filecat='../books/'.$book.'/'.$book.'.txt';$catlist=file($filecat, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$mysqli = new mysqli($Hostname,$Username,$Password,$DatabaseName);
$stmt = $mysqli->stmt_init();
if($stmt->prepare("SELECT `id`,`title`,`price`,`image`,`description`,`category`,`enablerating`,`rating` FROM ".$PapierTableName." WHERE `book`=? ORDER BY position ASC, title ASC")) {
$stmt->bind_param('s', $book);
$stmt->execute();
if( $stmt->bind_result($iden,$title, $price,$image,$description,$category,$enrat,$rating)){
$i=0;$rit=array();
while ($stmt->fetch()) {
$rit[$i]=array(invert_str(html_entity_decode($title,ENT_QUOTES,'UTF-8')),$price,invert_str(html_entity_decode($image,ENT_QUOTES,'UTF-8')),invert_str(html_entity_decode($description,ENT_QUOTES,'UTF-8')),invert_str(html_entity_decode($category,ENT_QUOTES,'UTF-8')),$enrat,$rating);
$i++;
}
$stmt->close();
$count=count($catlist);$ret=array();
for($i=0;$i<$count;$i++){$ret=array_merge($ret,search($rit,4,$catlist[$i]));}
echo json_encode($ret);
}
else
file_put_contents('binderror.txt',$stmt->error);
}
else
file_put_contents('connecterror.txt',$stmt->error);
$iden contiene valori (corretti), ho provato anche (string)$iden.