I saved my image path to a database and tried to retrieve the actual images using the code below.
<?php
$db = odbc_connect("asaa","asaa_user","asas");
$sql = "SELECT id, url, time FROM fotogalerie";
$res = odbc_exec($db, $sql);
while ($row = odbc_fetch_array($res)) {
print($row['id'].",".$row['url'].",".$row['time']."\n");
}
odbc_free_result($res);
odbc_close($db);
?>
Instead of getting the images that I need I get the output below:
101,/gg/en/pple/007_old/image1.jpg, 102,/gg/en/pple/007_old/image1.jpg,
101,/gg/en/pple/007_old/image2.jpg, 102,/gg/en/pple/007_old/image2.jpg,
101,/gg/en/pple/007_old/image3.jpg, 102,/gg/en/pple/007_old/image3.jpg,
where am I going wrong? Thank for your help.
Output Images from Database - Problem - help
Moderator: General Moderators
Re: Output Images from Database - Problem - help
This is where you have gone wrong i think.
What you are doing is just printing the url of the image as a string. It doesnot give any images.
try to put an image tag like this=>
Code: Select all
print($row['id'].",".$row['url'].",".$row['time']."\n");
try to put an image tag like this=>
Code: Select all
print($row['id']);
?>
<img src="<?php echo $row['url']; ?>" size=(your image size)/>
<?php
echo $row['time']."\n";
Re: Output Images from Database - Problem - help
thanks but now its giving me this output:
the flex brackets that i have put are actually triangles that r out put and if i place my mouse pointer on the triangles it displays a message with my image path and also says unresolved link. If i click the triangle it also outputs this code: <?php echo $row['url']; ?>
Code: Select all
101101 >102102 >101101 <102102 >101101 <102102 <101101 <102102 <101101 <102102Re: Output Images from Database - Problem - help
try this one
must be some problem with the url linking
must be some problem with the url linking
Code: Select all
<IMG height="image height" src="<?php echo (your url from db); ?>" width="imagewidth">