|
Can't display my image path stored in mysql database
Dear Friends,
Displaying image path stored in the database. I am successfully displaying other information stored in the database accept the image "Picture"
I have been trying to solve this for some time without success. I hope i should post on this vibrant forum for kind assistant.
This is my image upload file:
//clean vars for mysql use
$caccno=mysql_real_escape_string($_POST['accno']);
$cbal=mysql_real_escape_string($_POST['bal']);
$ctype = $_POST['select'];
$cname=mysql_real_escape_string($_POST['name']);
$caddress=mysql_real_escape_string($_POST['address']);
$cemail=mysql_real_escape_string($_POST['email']);
$cbusname=mysql_real_escape_string($_POST['busname']);
$cbusnat=mysql_real_escape_string($_POST['busnat']);
$cnextkin=mysql_real_escape_string($_POST['nextkin']);
$cavermon=mysql_real_escape_string($_POST['avermon']);
$cdate=mysql_real_escape_string($_POST['date']);
$cpicture=mysql_real_escape_string($_FILES['picture']['name']);
$csign=mysql_real_escape_string($_FILES['sign']['name']);
$target = "images/";
$target = $target . basename( $_FILES['picture']['name']);
//This gets all the other information from the form
$picture=($_FILES['picture']['name']);
//Writes the photo to the server
if(move_uploaded_file($_FILES['picture']['tmp_name'], $target))
{
//Tells you if its all ok
echo "The file ". basename( $_FILES['picture']['name']). " has been uploaded, and your information has been added to the directory";
}
else {
//Gives and error if its not echo "Sorry, there was a problem uploading your file.";
}
This is my display code:
$res = mysql_query($sql);
if($res){
while($row = mysql_fetch_assoc($res)){
echo ' <tr>
<td valign="top">'.$row['name'].'</td>
<td valign="top">'.$row['accno'].'</td>
<td valign="top">'.$row['busname'].'</td>
<td valign="top">'.$row['address'].'</td>
<td valign="top">'.$row['email'].'</td>
<td valign="top">'.$row['busnat'].'</td>
<td valign="top">'.$row['nextkin'].'</td>
<td valign="top">'.$row['avermon'].'</td>
<td valign="top">'.$row['date'].'</td>
Picture Code <td valign="top"><img src=?php echo "http://localhost/images/'.$row['picture'] .'?>"alt=”" name=”" width=”100? height=”90? border=”1? </td>
<td valign="top">'.$row['sign'].'</td>
<td valign="top">'.$row['pin'].'</td>
<td valign="top">'.$row['balance'].'</td>
<td valign="top"><a href="viewaccs.php?id='.$row['cusid'].'">View Accounts</a></td>
</tr>';
}
echo '</table>';
Your response would be highly appreciated.
|