2015-12-29 7 views
5

Bitte helfen Sie. Im Versuch, das Bild jeden Benutzers angezeigt werden mit ihrem Studentenausweis aber es zeigt unbekannte Zeichen als Bild auf meiner Seite, wie untenWie zeige ich Bild von mysql an PHP

% PH S $ ~ Q-} Y> ZTW), Gg ~) 1WN {,!^j-94K

$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>"; 
+2

Sie befinden sich bereits in 'PHP' an dieser Stelle' '. – chris85

+0

Wie chris85 sagte, entfernen Sie das und fügen Sie etwas wie. $ pp. –

Antwort

3

Das wird es tun. Sie müssen PHP-Tags nicht innerhalb von PHP-Tags öffnen.

$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>"; 

Ich gehe davon aus, dass die IMG-Daten korrekt sind.

+0

Danke Jungs. Es funktionierte. Ich bin so froh. Antworten so schnell. Danke – 4Jean

+0

Ich entfernte die Variable $ pp und benutzte Echo ' \t '; – 4Jean

+0

Schön, hat es funktioniert? – Phiter

Verwandte Themen