public function latestAds() { $data = array(); $db = $this->common_model->db; $db->select("*"); $db->from(ADVERTISE); $db->limit(10); $db->order_by("ad_created_date", "desc"); $query = $db->get(); $data = $query->result_array(); foreach ($data as $k => $v) { $data[$k]['ad_image'] = image(advertise_img_path() . $v['ad_image'], 'square'); } echo json_encode($data); exit; }
<div class="form-group"> <label>Image:</label> <input type="file" placeholder="ad image" class="validate[required]" name="ad_image" id="ad_image" value="<?php echo @$advertise[0]->ad_image; ?> "> </div> <?php if ($advertise[0]->ad_image != "") { ?> <div class="form-group clearfix"> <label></label> <div class="col-sm-7"> <p><img class='newimg' src='<?php echo advertise_img_path() . @$advertise[0]->ad_image; ?> '></p> </div> </div> <?php } ?> <div class="form-group"> <label>Link:</label> <input type="text" placeholder="Advertise link" class="form-control validate[required]" name="ad_link" id="ad_link" value="<?php echo @$advertise[0]->ad_link; ?> "> </div>