$sql = "SELECT images.id, title, image, note
FROM news
INNER JOIN images ON news.id = images.id_news
WHERE news.id=?
ORDER BY images.id DESC";
$stmt = $db->prepare($sql);
$stmt->execute(array($_GET['id']));
$e = $stmt->fetch();
foreach($e[] as $row)
{
$e[]=array(
'title'=>$row['title'],
'image'=>$row['image'],
'note'=>$row['note']
);
}
然后我有
Warning: Illegal string offset 'title' in C:\xampp\htdocs\Wazup.mn\inc\functions.inc.php on line 20
Warning: Illegal string offset 'image' in C:\xampp\htdocs\Wazup.mn\inc\functions.inc.php on line 21
Warning: Illegal string offset 'note' in C:\xampp\htdocs\Wazup.mn\inc\functions.inc.php on line 22