0

Currently I build a website, and the idea is that the index (front page) will show entries from all users as well as a main picture. I have considered the possibility that you can let users choose a primary picture when creating a topic, but I want this to happen automatically. I have also also considered that all images can be added to a database (which I will do anyway), and hinting to the specific post so that one of the images will be displayed on the front, but this will not work optimally for example, if users choose to remove a picture in the topic, but not delete it from the database.

So the question is: How can I make it possible to find the first or all images in a SQL insert, with PHP?

3
Contributors
3
Replies
5
Views
5 Years
Discussion Span
Last Post by diafol
0

you can limit the record

Example:
table imgs contains the following fields: imageId, articleId, imageUrl, dateUploaded
table articles contains the following fields: articleId, userId, articleContent, datePosted

select `imgurl` from `imgs` where `imgs`.`articleId` = `articles`.`articleId` limit 1

Edited by moonknight33

0

Sorry but it was not so informative for me. I need further explanation to figure this out.

Thank you anyway.

0

Sorry but it was not so informative for me. I need further explanation to figure this out.

It may be me, but I found your question a little confusing. Could you elaborate further?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.