Displaying images from a VARCHAR path in SQL Server, using PHP
Hey guys, so I have been trying to get images to appear with an SQL query using PHP.
My table has a column called picture, it is datatype nvarchar50. I have a folder in my project called images and in there an image called 4.png. So in the field of my picture column, I have the string, images/4.png.
In my query, I return data from a query and am trying to make an image show with this data, here is my query output code:
while( $row = sqlsrv_fetch_array ( $result, SQLSRV_FETCH_ASSOC))
{
echo 'ID number: '.$row['productID'];
echo '<br/> category: '.$row['category'];
echo '<br/> product name: '.$row['productName'];
echo '<br/> Range: '.$row['range'];
echo '<br/> description: '.$row['description'];
echo '<br/> size: '.$row['size'];
echo '<br/> colour: '.$row['colour'];
echo '<br/> availible: '.$row['available'];
echo '<br/> price: '.$row['price'];
echo '<br/> picture: <img src="'.['picture'].'">;
}
This works, but the last line doesn't, how can I load an image in my query from my project folder, I do not want to store images in the database, just strings linking to the images, can anyone please help me out?
Many thanks!
deucalion0
Junior Poster in Training
61 posts since Mar 2010
Reputation Points: 10
Solved Threads: 0
<img src="'.$row['picture'].'" />;
diafol
Rhod Gilbert Fan (ardav)
7,800 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
It works now thanks a lot!
deucalion0
Junior Poster in Training
61 posts since Mar 2010
Reputation Points: 10
Solved Threads: 0
diafol
Rhod Gilbert Fan (ardav)
7,800 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080