Monday, April 26, 2010

transform query result to populate dropdown?

Hi there,

as I have some trouble to manage the find() for my wishes, I did a
working sql expression and checked id using $debug.
Sadly the resultset is an array but not assotiativ as it needs to be
used to populate input dropdownbox.

My SQL is:
$Q_Zimmer="
SELECT id
FROM lodgings AS Zimmer
WHERE Zimmer.id NOT IN
(SELECT ls.id from booking_positions AS bs, lodgings AS ls
WHERE bs.lodging_id = ls.id
AND
bs.AnreiseDatum>='2010-05-25 12:00:00'
AND
bs.AbreiseDatum<='2010-05-30 12:00:00'
)";

$db=& ConnectionManager::getdataSource('default');
$dataZimmer=$db->query($Q_Zimmer);

This results me all the lodgings I want to get but is not able to be
used to fill the $lodgings as a find() would.

May somebody in here please help me
either to transfer the result to an useable arry
or
to recode my sql to be a find().

After looking the cakebook and having a view tryouts with no success
on it ... I ask ...

TIA

Michael

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: