Database StructureI am trying raw query in an controller(Codeigniter) and i am trying to get the values from the range provided by the user on newDate and newDate2..My problem is it displays nothing..How do i write the query for this..I just want to display the qty,productname,bundle according to the voucherno(vno)...Here is my tried code
Controller Code:
$startdate = $this->input->post('SDate');
$enddate = $this->input->post('EDate');
$date = str_replace('/', '-', $startdate);
$newDate = date("Y-m-d", strtotime($date));
$date2 = str_replace('/', '-', $enddate);
$newDate2 = date("Y-m-d", strtotime($date2));
$data['startdate'] = $startdate;
$data['enddate'] = $enddate;
$query = $this->db->query('SELECT `vno`,`Prdtname`,`Qty`,`bundle` FROM purchaseitem WHERE billdate >= "$newDate"AND billdate <= "$newDate2" ORDER by `vno`')->result_array();
$data['query'] = $query;
View Code:
<?php foreach ($query as $row): ?>
<tr><td></td><td></td><td></td><td></td>
<td><?=$row['Prdtname'];?></td>
<td><?=$row['Qty'];?></td>
<td><?=$row['bundle'];?></td>
<?php endforeach ?>