Ошибка: A PHP Ошибка обнаружена Серьезность: Уведомление
Сообщение: неопределенная переменная: записи
Имя файла: views / Search_data. php
Номер строки : 80
Backtrace:
Файл: /home/paychzaq/public_html/application/views/Search_data.php Строка: 80 Функция: _error_handler
Файл: / home /paychzaq/public_html/application/controllers/Search.php Строка: 13 Функция: представление
Файл: /home/paychzaq/public_html/index.php Строка: 315 Функция: require_once
Контроллер:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Search extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('Search_model');
$this->load->database();
$this->load->library('session');
}
function index(){
$this->load->view('Search_data');
}
public function searchUser() {
$key = $this->input->post('search');
if(isset($key) and !empty($key)){
$data['records'] = $this->Search_model->searchRecord($key);
$data['link'] = '';
$data['message'] = 'Search Results';
$this->load->view('Search_data' , $data);
}
else {
redirect('Search') ;
}
}
}
?>
Модель:
<?php
class Search_model extends CI_Model
{
public function searchRecord($key)
{
$this->db->select('*');
$this->db->from('campaigns');
$this->db->like('title',$key);
$this->db->or_like('category',$key);
$this->db->or_like('description',$key);
$query = $this->db->get();
if($query->num_rows()>0){
return $query->result();
}
}
}
?>
Вид:
<?php
foreach($records as $row)
{
$sr=$row->photo;
$ur= site_url()."/campaign_info/campaign_detail/".$row->campaignid."/".$row->title."";
?>
<div class="col-lg-3 col-sm-6">
<div style="height: 40rem;" class="card card-product">
<div class="card-header border-0">
<h2 class="h6">
<a href="#"><?php echo $row->title?></a>
</h2>
</div>
<!-- Product image -->
<figure class="figure">
<a href="<?php echo $ur; ?>"> <img alt="Image placeholder" src='<?php echo $sr; ?>' style="max-width: 100%; height: auto; object-fit: contain;" class="img-center img-fluid"></a>
</figure>
<div class="card-body">
<!-- Price -->
<div class="d-flex align-items-center mt-4">
<span class="h6 mb-0"> <?php echo $row->price?> RS</span>
<span class="badge badge-success rounded-pill ml-auto"><a style="color: white"href="<?php echo $ur;?>">Details</a></span>
</div>
</div>
<div class="p-4 border-top">
<div class="row">
<div class="col-6 text-center">
<a href="<?php echo "#abc".$row->campaignid;?>" class="btn btn-sm btn-white btn-icon-only rounded-circle ml-4" data-toggle="modal">
<span class="btn-inner--icon"><i class="fas fa-paper-plane"></i></span>
</a>
<span class="d-block text-sm">Send Proposal</span>
</div>
<div class="col-6 text-center">
<span class="h5 mb-0"><?php echo $row->deadline ?></span><sup></sup>
<span class="d-block text-sm">Deadline</span>
</div>
</div>
</div>
<?php
$url='proposal/validation/'.$row->campaignid;
?>
<div class="modal fade" id="<?php echo "abc".$row->campaignid;?>" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<?php echo form_open($url)?>
<div class="form-group">
<label class="form-control-label">
Your Fees
</label>
<input name="fee" type="text" class="form-control">
</div>
<div class="form-group">
<label class="form-control-label">
Days To Complete
</label>
<input name="days" type="text" class="form-control">
</div>
<!-- Project description -->
<div class="form-group">
<label class="form-control-label mb-0">
Details
</label>
<small class="form-text text-muted mb-2 mt-0">
This textarea will autosize while you type
</small>
<textarea name="details"class="form-control" data-toggle="autosize" rows="2"></textarea>
</div>
<button type="submit" class="btn btn-sm btn-primary rounded-pill mr-auto">Send</button>
<?php echo form_close()?>
</div>
</div>
</div>
</div>
<div class="card-footer">
<div class="actions d-flex justify-content-between">
<a href="#" class="action-item">
<i class="fas fa-star"></i>
</a>
<a href="#" class="action-item">
<i class="fas fa-chart-pie"></i>
</a>
<a href="#" class="action-item text-danger">
<i class="fas fa-trash-alt"></i>
</a>
</div>
</div>
</div>
</div>
<?php
}
?>