PHP code to prevent empty database field from displaying
I have just upgraded to DW CC2015 and purchased the entire WebAssist Suite. I have always used some PHP code to make it so an empty database field will not display on the web page. Very simple and always worked. Now, for some reason it no longer works and it's a critical thing for the websites I develop. Here is the code (recordset and field names changed to protect the innocent):
<?php if($row_rsRecordset['db_field']<>"") { ?><a href="<?php echo($row_rsRecordset->getColumnVal("db_field")); ?>" target="_blank">Website</a><?php } ?>
I have also tried !="" instead of <>"" and <? }?> at the end instead of <?php } ?> and still didn't work.
This is basically a text link to display a link to an author's website. If the field is empty (no URL in the field), the text should not display. The problem is that it never displays. I have the same thing for Facebook and Twitter for the author, and the same thing happens - nothing displays. I have probably 20 websites where I use this same code and it works fine, mostly implemented in Dreamweaver CS6 or earlier. Any idea what this is not working now. I have spent hours today trying to figure it out with no success. The MySQL database is the same, and I have checked the data and the fields, everything is as it should be but it doesn't work. Very frustrated!!
I have also tried it where some authors have a photo and some don't, so I want to hide it when they don't. Same problem. When I wrap the code around the image, none of them show up.
Thanks,
John Burke