在尝试使用这种方式检索存储在数据库中的blob值时,我有问题。请帮助我。
$criteria = [
'lotItemNumber' => '',
'artistName' =>$_POST['artistName'],
'classification' =>$_POST['classification'],
'producedYear' =>$_POST['producedYear'],
'auctionDate' =>$_POST['auctionDate'],
'textualDescription' =>$_POST['textualDescription'],
'estimatedPrice' =>$_POST['estimatedPrice'],
'image' =>'$temp'
];
$stmt = $stmt->insert($criteria);
echo'<imgsrc="data:image/jpeg;base64,'.base64_encode($row['image']).'width="250" height="250">';
echo '<img src="data:image/jpeg;base64,'.base64_encode($row['image']).'" width="250" height="250">';
^ space here ^ close quote and add space
此外,应更改插入值:
$criteria = [
//...
'image' => $temp, // do not use single quotes
];