how i can use where function in the select options
how i can use where function in the select options
saee2838
Posts: 18Questions: 6Answers: 0
in DataTables
Editor::inst( $db, 'users_visits', array('event_id', 'event_level') )
->where( 'event_id', $eventid )
->debug( true )
->field(
Field::inst( 'users_visits.event_id' )
->options( Options::inst()
->table( 'sport_calendar_match_events' )
->where('id',$event_id) <<<<<<<<<<<<<<<<<<<<<<<-------------------------- do not work
->value( 'id' )
->label( array('name') )
)
->validator( 'Validate::dbValues' ),
Field::inst( 'users_visits.level_name' )->validator( 'Validate::notEmpty' ),
Field::inst( 'users_visits.competition_type' ),
Field::inst( 'sport_calendar_match_events.name' )
->set( false )
)
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
That should be all you need to do. I would point out on line 8 you have
$event_id
while on line 2 you have$eventid
. Is that intentional?Allan
i change it
but it dosent work
when i add ->where( 'id' , $eventid )
it dosent work
i test ->where( 'id' , 1)
but not working
i try with compoundKey example in source
but it dose not work
when i use this code
its work
but when i use $userid in second where it dosent work
That is correct and expected as that's how PHP closures work. You need to use the
use
statement:See the PHP documentation on anonymous functions for more details.
Allan