Myrmidon16
02-27-2012, 08:05 PM
Hello all;
What I am trying to do is use a database to reference to image files I have uploaded onto my website's server space. Initially I want to draw one image from the database, and use further coding to switch that image with another image in the database. I was able to show all of the images in the database:
<?php
$sql = "SELECT owimgpath,
owimgname
FROM
overworld
ORDER BY
owimg_id";
$result = mysql_query($sql);
$ext = ".png";
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$path = $row['owimgpath'];
$name = $row['owimgname'];
$img = $path.$name.$ext;
echo "<img src='".$img."' />";
}
?>
However, I want to build the connection with the database but only show the image I want to show. Please let me know if you have any suggestions or questions as to how I want this to work. Thank you.
What I am trying to do is use a database to reference to image files I have uploaded onto my website's server space. Initially I want to draw one image from the database, and use further coding to switch that image with another image in the database. I was able to show all of the images in the database:
<?php
$sql = "SELECT owimgpath,
owimgname
FROM
overworld
ORDER BY
owimg_id";
$result = mysql_query($sql);
$ext = ".png";
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$path = $row['owimgpath'];
$name = $row['owimgname'];
$img = $path.$name.$ext;
echo "<img src='".$img."' />";
}
?>
However, I want to build the connection with the database but only show the image I want to show. Please let me know if you have any suggestions or questions as to how I want this to work. Thank you.