I am using the following query to display a background image for each page based on the page ID:
public function get_background($page_id)
$sql = "SELECT background
WHERE page_id = ?";
$stmt = $this->pdo->prepare($sql);
That works well the only thing is for the index page (page_id = 1) I have mulptiple image in the database. I would like to display a random image for the index page, but still want to be able to use the same query for the other pages as well. So I need a ORDER BY RAND() clause that only will fire when page_id = 1. How do I do that?
Thank you in advance