[eluser]Unknown[/eluser]
Hi I'm new in CI, I was working on with my form when I got stuck with this error:
my model:
public function search_entry
($subject, $message
)
{
$this->db
->select
('index', 'subject', 'writer', 'registerTime');
$this->db
->from('t_board');
$this->db
->like
('subject', $subject);
$q =
$this->db
->get();
return $q->result();
}
my controller:
function index()
{
$this->load
->model
('DbSimplex');
$data['query'] =
$this->DbSimplex
->search_entry($subject =
$this->input
->post
('subject'), $message =
$this->input
->post
('message'));
if(
$this->input
->post
('search'))
{
$this->subject = $this
->input
->post
('subject');
$this->message = $this
->input
->post
('message');
echo
$this->subject;
echo
$this->message;
$data['query'] = $this
->DbSimplex
->search_entry($subject = $this
->input
->post
('subject'), $message =
$this->input->post
('message'));
$this
->load
->view
('board', $data);
}
$this->load
->view
('board', $data);
}
my view: board.php
<?php foreach($query as $value){ ?>
<tr>
<td>
<?php echo $value->index; ?></td><!--post index. retrieved from db-->
<td class="subject">
<input type="checkbox" id="" name="" value="" title="" />
<a href="#">
<?php echo $value->subject; ?></a>
</td><!--subject or post title. retrieved from db-->
<td>
<?php echo $value->writer; ?></td><!--writer's name. retrieved from db-->
<td>
<?php echo $value->registerTime; ?></td><!--written date. retrieved from db. Timestamp in DB. display format:dd/mm/yyyy-->
</tr>
<?php } ?>
everytime I hit the search button this error comes out in my table:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$writer
Filename: views/board.php
Line Number: 49
I'm totally lost I don't know what went wrong with my code... I would appreciate your help I've attached a printscreen of this error message
thank you so much in advance