anybody i need the codes to display image. im stucked with it. Im already done doing the codes for uploading.
see it below..
i badly need it
<?php
// Create MySQL login values and
// set them to your login information.
$username = "root";
$password = "";
$host = "localhost";
$database = "db1";
// Make the connect to MySQL or die
// and display an error.
$link = mysql_connect($host, $username, $password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
// Select your database
mysql_select_db ($database);
// Make sure the user actually
// selected and uploaded a file
$target_path = "images/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
//echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
$sql = "INSERT INTO tb_product (product_image)values('$target_path')";
$result=mysql_query($sql);
mysql_close($link);
header ('Location: viewproducts.php');
} else{
echo "There was an error uploading the file, please try again!";
}
// Close our MySQL Link
?>