i need query in example editor

i need query in example editor

rrzavaletarrzavaleta Posts: 78Questions: 52Answers: 2

datatableseditor in the examples , only the fields of database is added and these are executed in automatic ie a query for all records do.

What I do is a query for example select * from people where id = " 1". but I also want to use the editor buttons themselves .

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    I'm afraid I don't really understand what you are asking. Do you want to use select *, or is it about the where condition?

    For where use the where() method.

    For select * that isn't possible. You need to specify the fields explicitly so Editor knows what to work with.

    Allan

  • rrzavaletarrzavaleta Posts: 78Questions: 52Answers: 2

    ok, for example
    SELECT id, name FROM datos WHERE id="5" AND NAME = "allan";
    as is written using WHERE syntax in the editor?

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    In the PHP libraries you would use:

    ->where( 'id', '5' )
    ->where( 'NAME', 'allan' )
    

    For more control in 1.4 you can give it a closure:

    ->where( function ( $q ) {
      $q
        ->where( 'id', '5' )
        ->and_where( 'NAME', 'allan' );
    } )
    

    Allan

This discussion has been closed.