Forums
This topic is locked
default image in php database search
Posted 21 Aug 2008 10:20:23
1
has voted
21 Aug 2008 10:20:23 Bernie Zuecker posted:
Thank you for the answer to my last post, not axactly what I was looking for, but I have worked it out (hopefully). Anyway I have been trying to do this now for the last 4 hours and I am stumped. I want to replace a dynamic image with a static image when there is no dynamic image. I have read and tried and dont know what to do next. I keep getting errors, here is the code I am working on, using PHP and MYSQL and Dreamweaver. Thanks<?php if($row_rsStock['photo0'] <> NULL) ?> {<img src="images/upload/<?php echo $row_rsStock['photo0']; ?>
// Show Recordset Image
} <?php else {<img src="images/upload/nophoto.jpeg" width="150" height="150">
// Show Default Image
} endif ?>
Thanks for anyones help.
Replies
Replied 22 Aug 2008 13:59:12
22 Aug 2008 13:59:12 Alan C replied:
HI
you could put the static image into the field as a default value (in the mysql table), then it will get overwritten when there will always be an image to show, that way you just show whatever is in the field, that's how I did something similar
you could put the static image into the field as a default value (in the mysql table), then it will get overwritten when there will always be an image to show, that way you just show whatever is in the field, that's how I did something similar