Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

PHP Syntax help calling file name from database

images php coding issues or problems here.

Moderators: macek, egami, gesf

PHP Syntax help calling file name from database

Postby chainsawal » Tue Sep 18, 2012 7:37 pm

Relatively new user to PHP and have been unable to solve the problem for days.

I am successfully pulling business name, address, city, state, etc.. information back from a database via while loop and everything works great UNTIL I try to call the name of the image and file location with a <img src> statement.

All my images are in a folder named "logos" and the database holds the exact file name (e.g. logo.jpg)

When I call a static image back it works fine (i.e. echo "<img src=\"logos/image.jpg\">". As soon as I try to code php to make it dynamic based on the field 'business_logo' I get no image...even though I have no errors. I am escaping the double quotes but have tried both escaping the slash in the file name and not escaping it... it doesn't seem to matter as nothing is pulled back.

I have also tried putting the entire file structure in the database and just calling it without concatenating with no success (e.g. logos/image.jpg).

Thanks in advance for your help... I am sure this is something easy that I am missing.

Chainsawal

Code: Select all
<?php
while ($row=mysql_fetch_array($result)) {
echo "<div class=\"article\">"
.$row['business_name']."<br/>"
.$row['business_address'].
.$row['business_city'].","
.$row['business_state']."<br/>";
echo "<img src=\"logos/\".$row['business_logo'];
echo "/>";
}
<?
chainsawal
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Sep 18, 2012 7:18 pm

Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron