tpohara Posted July 17, 2011 Share Posted July 17, 2011 Hi, I'm trying to edit some rather complicated code, but essentually I am attempting to load an image into a PHP page, based on a SQL query. My site is working with Oracle and is working fine. I wish to add one function where I load an image into a php page based on the name of a file stored in a relational database, the image is located on a local hard drive. The query part is working fine as the top portion is getting the name and placing it into the table. I am attempting to insert the database result into the field where the image would normally just be entered. When I attempt to pass the variable into the string for the the image portion it will not work. Any ideas, any help would be grateful. Thanks. Clealry I am missing something basic here. The path is displayed in the table but will not get drawn in to the image section. Sample of the code: <!-- This page gets the information to display for a shelf and shows a picture of it. --> <HTML> <?php import_request_variables("gpc"); $bay = $_POST['bay']; //query to get picture path information $qry = "select * from shelf_rec shelf, database.model part, database.nodes node where node.object_id = '$shelf' and node.part_id = part.part_id and shelf.object_id = node.object_id"; $stmt = OCIParse($conn, $qry); OCIExecute($stmt); while ($row = oci_fetch_array ($stmt)) { $s_photo_path = $row['PHOTO_PATH']; } //display shelf information // GET A TABLE IN HERE............ echo"<TR>"; echo "<TD><FONT COLOR='PURPLE'><B>Photo Path:</B></FONT></TD>"; echo "<TD><FONT COLOR='red'><I>          $s_photo_path</FONT></TD>"; echo"</TR>"; echo"</table>"; echo"<br clear='left'>"; ?> <CENTER><H2> <img border="0" src="$s_photo_path" width="284" height="144"> </CENTER></H2> <center> <FONT SIZE="3">$s_photo_path</FONT> <br> <br> </center> </BODY> </HTML> Quote Link to comment https://forums.phpfreaks.com/topic/242161-php-variables-and-image-load/ Share on other sites More sharing options...
QuickOldCar Posted July 17, 2011 Share Posted July 17, 2011 You need to wrap in php tags and also echo the variable as one example from this: <img border="0" src="$s_photo_path" width="284" height="144"> to this: <img border="0" src="<?php echo $s_photo_path;?>" width="284" height="144"> Quote Link to comment https://forums.phpfreaks.com/topic/242161-php-variables-and-image-load/#findComment-1243622 Share on other sites More sharing options...
tpohara Posted July 18, 2011 Author Share Posted July 18, 2011 Thank you. Solved. Quote Link to comment https://forums.phpfreaks.com/topic/242161-php-variables-and-image-load/#findComment-1243944 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.