Saturday, March 18, 2017

Modify column value on query

My database has a column that stores names of image files.

Currently, when I query the database for these image file names, I have to concatenate the URL to the image in my HTML, like:

<img src="" />

Instead, what I'd rather do is modify the column value in the query so that it sends the data as a URL.

So instead of querying the database and getting image1, it would return http://www.website.com/img/image1.png. This will also help for when I add an API and need to return a URL rather than just the file name.

How can I do this?



via user7733059

Advertisement