Hide image and text on dynamic page if there's no input in database

Perhaps you should first show the related code to your problem?

When you are using → a dynamic page then you surely use a dynamic-dataset.
That means every-time when you switch from item to item…

$w.onReady(()=>{
	$w('#dataset1').onReady(()=>{
		let item $w('#dataset1').getCurrentItem(); console.log(item)
	});
});

You would get always just the one chosen current item as result.
Now you can solve your issue in several ways…

  1. using —> isEmpty
  2. using —> isNotEmpty
  3. using an if-else-query

Let me show you the example with the if-else-query…

$w.onReady(()=>{
	$w('#dataset1').onReady(()=>{
		let item $w('#dataset1').getCurrentItem(); console.log(item)
		if(item) {
			console.log("Item found!"
			//place here your code to show() the related IMAGE
		)}
		else{
			console.log("Item not found!")
			//place here your code to hide() the related IMAGE
		}
	});
});