Hi, i need help please!

i have a page were users can upload images, the name and path to where the image is stored is stored in the database. I want the aministartor to be able to view all of the images. when i try this it returns the path on screen rather than the image. can someone melp tell me if i am complety wrong or what i am missing.

the code used to view them all is below:

<?php

$image_path = 'C:/wamp/www/Playhill/images/';

$sql="Select * From images";

$result = @mysql_query($sql);


	$result = mysql_query("Select * From images");
	  print ' <table class="border"><th> Name <th> Photo </th>';
	  
	  while ($row = mysql_fetch_array($result))
	  {
	   print
	   "<tr><td>".$row['name']."</td><td>". $image_path . $row['path'] ."</td></tr>";
   }
   
  print "</table>";

mysql_close($con);

?>

The following code should display the name and the image in a table.

$image_path = 'C:/wamp/www/Playhill/images/';

$sql="SELECT * FROM images";
$result= mysql_query($sql) or die ("Could not execute query : $sql." . mysql_error());

echo "<table class=\"border\"><th> Name <th> Photo </th>";
while ($row = mysql_fetch_array($result)) {
	echo "<tr><td>".$row['name']."</td><td><img src=".$image_path.$row['name']."/></td></tr>";
}
echo "</table>";

i tried that and it displays nothing in the 2nd column where the images should be, any other suggestions i could try? thanks

Well, it appears the path you have is wrong. You need the path as the webserver sees it, not as the OS sees it. So this:

$image_path = 'C:/wamp/www/Playhill/images/';

Should probably be this:

$image_path = '/Playhill/images/';

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.