0

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);

?>
3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by genevish
0

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>";
0

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

0

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/';

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.