Hi I got the problem when run this code.That is when i retrive the data and image from the database table same image will displayed all that time when i give the different images .But other fields correctly displayed . plz tell the problem in that code.
[php]<?php
$con = mysql_connect(" localhost","roo t","sreeni") ;
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db ("my_db1", $con);
// Find out about latest image
$result = mysql_query("SE LECT * FROM pix1");
if ($row = @mysql_fetch_as soc($result)) {
$bytes = $row[upload];
} else {
$errmsg = "There is no image in the database yet";
$title = "no database image available";
// Put up a picture of our training centre
$instr = fopen("latest.i mg","rb");
$bytes = fread($instr,fi lesize("latest. img"));
}
// If this is the image request, send out the image
if ($_REQUEST[gim] == 1) {
header("Content-type: image/jpeg");
print $bytes;
exit ();
}
echo "<table border='1'>
<tr>
<th>Photo</th>
<th>name</th>
<th>email</th>
<th>location</th>
<th>message</th>
</tr>";
while($row = mysql_fetch_arr ay($result))
{
echo "<tr>";
echo "<td>
<img src=?gim=1 width=150 height=100>
<b><?= $title ?>
</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['location'] . "</td>";
echo "<td>" . $row['message'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($co n);
?>[/php]
[php]<?php
$con = mysql_connect(" localhost","roo t","sreeni") ;
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db ("my_db1", $con);
// Find out about latest image
$result = mysql_query("SE LECT * FROM pix1");
if ($row = @mysql_fetch_as soc($result)) {
$bytes = $row[upload];
} else {
$errmsg = "There is no image in the database yet";
$title = "no database image available";
// Put up a picture of our training centre
$instr = fopen("latest.i mg","rb");
$bytes = fread($instr,fi lesize("latest. img"));
}
// If this is the image request, send out the image
if ($_REQUEST[gim] == 1) {
header("Content-type: image/jpeg");
print $bytes;
exit ();
}
echo "<table border='1'>
<tr>
<th>Photo</th>
<th>name</th>
<th>email</th>
<th>location</th>
<th>message</th>
</tr>";
while($row = mysql_fetch_arr ay($result))
{
echo "<tr>";
echo "<td>
<img src=?gim=1 width=150 height=100>
<b><?= $title ?>
</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['location'] . "</td>";
echo "<td>" . $row['message'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($co n);
?>[/php]
Comment