Welcome Guest, Not a member yet? Register   Sign In
Poll Query
#7

[eluser]wowdezign[/eluser]
Code:
considering i’d make two queries one for the questions and another for the options
how can i pass the poll id into the displayOptions function, i must extract the id from the array $data[‘poll’] , how ?

$data[‘poll’] = $this->MPoll->displayPoll(); //
  
$data[‘options’] = $this->MPoll->displayOptions(????);

How about:

Code:
$data[‘poll’] = $this->MPoll->displayPoll();
$data[‘options’] = $this->MPoll->displayOptions($data['poll']->id);

Once you have the object stored in a variable, you can access its properties. In this case, $data is an array, the array key 'poll' refers to an object that has an id property. So, $data['poll']->id should work.

You have to be aware of what you are returning from your model. If it is an array, you'll need to do:

Code:
$data[‘poll’] = $this->MPoll->displayPoll();
$data[‘options’] = $this->MPoll->displayOptions($data['poll']['id']);

instead.


Messages In This Thread
Poll Query - by El Forum - 11-08-2009, 10:40 PM
Poll Query - by El Forum - 11-08-2009, 10:47 PM
Poll Query - by El Forum - 11-08-2009, 10:50 PM
Poll Query - by El Forum - 11-08-2009, 10:59 PM
Poll Query - by El Forum - 11-08-2009, 11:05 PM
Poll Query - by El Forum - 11-09-2009, 06:00 PM
Poll Query - by El Forum - 11-09-2009, 10:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB