Reputation: 15
I've created a website and I'm using PHP to fetch an Oracle database table.
I've coded the Oracle database table with the correct image file names and uploaded the pictures to a online directory but it's not showing up on the webpage.
This is my code fetching results from the database.
<?php
while(oci_fetch_array($stmt)) {
echo("<tr valign=top bgcolor=#ccffcc>");
$fg1 = oci_result($stmt,"TITLE"); //"Title";
echo("<td width=100>");
echo ($fg1);
echo("</td>");
// Aspect value in column two
$fg2 = oci_result($stmt,"AUTHOR");//"Author";
echo("<td width=100>");
echo ($fg2);
echo("</td>");
$fg3 = oci_result($stmt,"PRICE");//"Price";
echo("<td width=75>");
echo ($fg3);
echo("</td>");
$fg4 = oci_result($stmt,"PHOTO");//"Photo";
echo ("<br><img src=http://xxxxxx.kz/home/preznek/public_html/website/search_pics".$fg4."><br>");
echo("</td>");
echo("</tr>");
}
oci_close($connect);
?>
What am I doing wrong?
Upvotes: 0
Views: 78
Reputation: 924
Try this please,
change this,
echo ("<br><img src=http://xxxxxx.kz/home/preznek/public_html/website/search_pics".$fg4."><br>");
to this,
echo "<br><img src='http://xxxxxx.kz/website/search_pics/".$fg4."'><br>";
You really don't need to use echo ("")
you can just use it like this echo ""
.
I changed you code this might help you as well
<table>
while(oci_fetch_array($stmt)) {
//Variables
$fg1 = oci_result($stmt,"TITLE"); //"Title";
// Aspect value in column two
$fg2 = oci_result($stmt,"AUTHOR");//"Author";
$fg3 = oci_result($stmt,"PRICE");//"Price";
$fg4 = oci_result($stmt,"PHOTO");//"Photo"; ?>
<tr valign="top" bgcolor="#ccffcc">
<td width="100">
<?php echo $fg1;?>
</td>;
<td width="100">
<?php echo $fg2;?>
</td>
<td width="75">
<?php echo $fg3;?>
</td>
<td>
<img src="http://xxxxxx.kz/website/search_pics/<?php echo $fg4?>">
</td>
</tr>
<?php } ?>
</table>
Try this and let me know if it works or not.
Upvotes: 0
Reputation: 1556
Two problems at a quick glance.
<img src="/path/to/image.jpg"/>
Upvotes: 1