I am having problem displaying the actual image on my website. In my website I am having users uploading images so that they can only view their own images. I feel like my code works up until the actual image is not display. Here is my code below
<?php
session_start();
error_reporting(0);
$userEmail = $_SESSION['userEmail'];
//configure the database
mysql_connect("localhost", "root", "") or die(include "../database/server.php");
mysql_select_db("cis_dept") or die(include "../database/error.php");
//generate a query
$sql = "SELECT image
FROM student inner join image on student.email = image.studentEmail
WHERE email = '$userEmail'";
$result = mysql_query($sql);
//include header
include_once '../attach/header.php';
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>View Images - <?php print $_SESSION['userFirst'].' '.$_SESSION['userLast'];?></title>
</head>
<body>
<!--add a header that will include links for the pages-->
<header>
<div id="links">
<label><a href="../student/welcome.php">Home</a></label> |
<label><a href="../student/upload.php">Upload Image</a></label>
</div><!--end of links-->
</header><!---end of header--->
<div id="mainContent">
<div id="bodyContent">
<h2>View <?php print $_SESSION['userFirst'];?>'s Images</h2>
<div class ="uploadInfo">
<p>
View your images below.
</p>
</div>
<div class="register">
<table>
<tr>
<td>
<?php
if(mysql_num_rows($result) == 0)
{
header("Location: ../student/noImage.php");
}
else
{
while($row = mysql_fetch_array($result))
{
print '<img src=" '.$row['image']. '" alt="'.$row['image'].'" width="135" height ="100"/>'.' ';
}
}
?>
</td>
</tr>
</table>
</div>
</div><!---end of body content--->
</div><!---end of main content-->
</body>
</html>
<?php
//include footer
include_once '../attach/footer.php';
?>
In addition here is the image that is causing the issue. Is there anything missing that I need to add to the code?
Thanks,
AJ

New Topic/Question
Reply



MultiQuote







|