craigeves Posted March 5, 2010 Share Posted March 5, 2010 Hi Please help. I want to be able to show a standard photo if the row 'photo' in my database is empty. This script will show the uploaded photo if the row isn't empty but for some reason wont show the standard photo if the row is empty. Can anyone help? Thanks <?php $sitephoto = $row_getUsers['photo']; if (empty($row_getUsers['photo'])) { $row_getUsers['photo'] = '<img src="../sites/images/uploadaphoto.gif" width="200" height="128" />'; } echo '<img src="../sites/images/profiles/'.$sitephoto.'" title="Photo" alt="Photo" />'; ?> Link to comment https://forums.phpfreaks.com/topic/194227-show-different-image-if-row-empty/ Share on other sites More sharing options...
craigeves Posted March 5, 2010 Author Share Posted March 5, 2010 I think i just answered my own question... <?php $sitephoto = $row_getUsers['photo']; if (empty($row_getUsers['photo'])) { echo '<img src="../sites/images/uploadaphoto.gif" width="200" height="128" />'; } else echo '<img src="../sites/images/profiles/'.$sitephoto.'" title="Photo" alt="Photo" />'; ?> Link to comment https://forums.phpfreaks.com/topic/194227-show-different-image-if-row-empty/#findComment-1021859 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.