Can you use PHP to show a default image if the image field

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aris1234
Forum Newbie
Posts: 11
Joined: Mon May 07, 2007 7:10 am

Can you use PHP to show a default image if the image field

Post by aris1234 »

Can you use PHP to show a default image if the image field in a database row is empty?

I'm creating a news page, but the client may not always upload an image with a news story. I know how to hide the area, but this leaves a big blank space. It would be much better if a default image were to appear.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

All it takes is an if construct
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

It'd be better to do that with a database level 'if' I reckon.
Post Reply