Still stuck on images with php.
I want users who are logged in to see the images they uploaded. I got scripts working but the get image file is not bringing image according to specific user.
The problem seem to be in the query. I always get the first image in table instead of specific one.
<?php
if(!isset($_SESSION)){
session_start();
}
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_connAdmin = "localhost";
$database_connAdmin = "mystuff";
$username_connAdmin = "root";
$password_connAdmin = "dck19idea";
$connAdmin = mysql_pconnect($hostname_connAdmin, $username_connAdmin, $password_connAdmin) or trigger_error(mysql_error(),E_USER_ERROR);
?>
<?php
$colname_Recordset1 = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_Recordset1 = $_SESSION['MM_Username'];
}
//$id = addslashes($_REQUEST['user_id']);
$image = mysql_query("SELECT image.name, image.content, image.user_id, users.user_name, users.user_id FROM mystuff.image JOIN users WHERE users.user_name='$colname_Recordset1'");
$image = mysql_fetch_assoc($image);
$image=$image['content'];
header("Content-type: image/jpeg" );
echo $image;
?>
Again, any help is appreciated.