[eluser]The Revel[/eluser]
I am lost, I cannot figure out how to use the results from one query to grab the info from another query.
Here is the function:
Code:
function search_scancode()
{
$q1 = $this->db->from('users')
->where('scancode', $_POST['searchcode'])
->get();
if ($q1->num_rows() > 0)
{
$this->data['user'] = $q1->row();
}
$q2 = $this->db->select('SUM(amount) as sum_amount', FALSE)
->from('transactions')
->where('email', $this->data['user']->email)
->group_by('email')
->get();
if ($q2->num_rows() > 0)
{
$this->data['sum'] = $q2->row()->sum_amount;
}
$this->template
->title( 'Last Minute Printing', 'Print Card')
->set_layout('login')
->build('auth/scan_view', $this->data);
I get nothing but errors when I try and view the page. The first of which is
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined property: Auth::$data
Filename: controllers/auth.php
Line Number: 640
Which points to this line
Code:
->where('email', $this->data['user']->email)
How do I pass results from one query into another?