Please help. Im trying to display the image of each user using their student ID BUT it displays unknown characters as image on my page as below
% S$P H ~Q - }Y>ZTW ?) ,G ? g ~) 1WN { , ! ^j- 9 4 K
$sql_up="SELECT content FROM sp_uploads WHERE s_id= 'RC49557'";
$result_set=mysql_query($sql_up);
while($row_up = mysql_fetch_array($result_set))
{
$pp = $row_up['content'];
}
echo "<td>
<img style=\"float:right; margin:5px; width:150px; height:150px; padding:10px; \"
src=\" data:image/jpg;charset=utf8;base64,<?php echo $pp ?> \" /> </td>";
This will do. You don't need to open PHP tags inside PHP tags.
$sql_up="SELECT content FROM sp_uploads WHERE s_id= 'RC49557'";
$result_set=mysql_query($sql_up);
while($row_up = mysql_fetch_array($result_set))
{
$pp = $row_up['content'];
}
echo "<td>
<img style='float:right; margin:5px; width:150px; height:150px; padding:10px;'
src='data:image/jpg;charset=utf8;base64, $pp' /> </td>";
I'm assuming the img data is correct.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.