Jump to content

display image from mysql


Tiruak

Recommended Posts

Hello there,

I've tried everything I can possible think of, and don't seem to get this to work. Once again, I'm new to php :)

 

I have a database where I upload the user picture. I can get my form to upload and store the image on the database together with my user info. So now, when I try to echo the picture on my user profile, it just shows a bunch of invalid characters, probably due to a header problem.

Now, maybe I'm missing the point here, but as far as I've learned, I need to call a header at the beginning of my script, before any html is displayed. But, if I do use something like //  header('Content-type: image/jpg');  //

at the beginning of my page, it actually makes all my page mess up, and still doesn't show the image.

 

I'm contacting the database correctly, selecting the right user, storing all his info into my array, and trying to display the  $user['usr_photo'] of my array.

 

I appreciate any help.

Link to comment
https://forums.phpfreaks.com/topic/205301-display-image-from-mysql/
Share on other sites

Can't edit anymore:

 

Here is what I'm trying to do (the code is just an example, of course):

<?php require_once("../includes/connection.php"); ?>
<?php require_once("../includes/functions.php"); ?>

<?php
// header('Content-type: image/jpeg');
$sel_arb = get_arbitro_by_id($_GET['arb']);
//echo $sel_arb['arb_photo'];
?>

<html>
<head>
	<title>The title is this</title>
</head>
<body>
	<table width=50%>
		<tr>
			<td>Name is <?php echo $sel_arb['arb_nome'];?></td>
			<td><?php echo $sel_arb['arb_photo'];?></td>
		</tr>
	</table>
</body>
</html>
<?php require("../includes/footer.php"); ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.