Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option #1: produce an img tag only if there is a location:
- while($row=$result->fetch()){
- //...
- if(!$row['location']==''){ // Check if the location IS NOT empty
- echo '<img scr="' . $row['location'] . '">';
- }
- }
- Option #2: produce the img tag anyway (to preserve space maybe), but specify a style attribute to it if empty location.
- while($row=$result->fetch()){
- //...
- echo '<img scr="' . $row['location']'; // the img tag isn't closed yet...
- if($row['location']==''){ // If the location IS empty
- echo '" style="border:0 !important;">'; // Specify style and close the tag.
- }else{
- echo '">'; // Just close the img tag.
- }
- Option #3: a script to remove the border on empty images, client side.
- <script>
- $(document).ready(function(){
- $("img").each(function(){
- if($(this).attr("src")==""){
- $(this).css({"border":"0 !important"});
- }
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment