I want to save the last generated voucher in a variable and used as an input for another query..
$last = $this->db->query('SELECT MAX(voucherno) AS `last` FROM `purchasebill` ORDER BY no DESC LIMIT 1')->row_array();
$result = $this->db->query("SELECT * FROM `purchaseitem` where vno= '$last[0]' ORDER BY vno " )->result_array();
I tried like the above code it gives me an error undefined offset 0..Help me to save the last generated voucher no in an last variable