Announcement

Collapse
No announcement yet.

PHP Help!!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP Help!!

    Hello,

    Here is the issue: I have a new review site. When a Featured search result comes up it shows a banner/icon in front of the query, as opposed to the standard querys with no banner/icon. The problem comes in when a client does not upload a banner/icon. In that case a rectangle box shows in its place. I need a default banner/icon to show when one is not uploaded. Here is a snippet of my code showing how the banner/icon is displayed.

    PHP Code:

    <div class="panel panel-default">
    <div class="panel-heading">
    <h3 class="panel-title"><font color="red"><i class="fa fa-star"></i> Featured</font> - <i class="fa fa-<?php echo $result['item_icon'];?>"></i> <a href="display.php?id=<?php echo $result['item_id'];?>"><strong><?php echo $result['item_title'];?></a></strong> - <a href="list.php?cat=<?php echo $result['item_cat'];?>"><?php echo $category['category_name'];?></a> in <a href="list.php?loc=<?php echo $result['item_location'];?>"><?php echo $location['location_name'];?></a></h3>
    </div>
    <div class="panel-body">
    <div class="row">
    <div class="col-md-4">
    <img width="300" height="65" src="<?php echo $result['item_banner'];?>">
    </div>

    ....

    Thanks for the help!!!

  • #2
    There are two ways you could do this. The first would be on the upload page. If the user doesnt enter a banner/icon then a default icon should be inserted, this would be the better way to do it in my opinion. The second way would be to edit the above code and put in a condition

    PHP Code:

    if ($result['item_banner'] == null)
          
    $result['item_banner']="http://mydomain.com/default_icon.jpg"

    Comment


    • #3
      This didn't work, but I made a work around by taking away their ability to upload their own icon and put a rotating/random icon for them when they sign up. Thank you for your help.

      Comment

      Working...
      X