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
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"); ?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.