mysql select statement to generator code?

mysql select statement to generator code?

wyatt121wyatt121 Posts: 9Questions: 1Answers: 0

Hi,

I used the generator to get a quick functional table working. Yet, now I want to add a quick simple mysql select statement to only pull the records I'm looking for into the table. I have this statement. Where do I add it to make it work?

select * from TABLE where x = '1';

I've tried deciphering the documentation, but I'm unfortunately a bit overwhelmed by the complexity. Any help is much appreciated.

Thank You.

Wyatt

Replies

  • allanallan Posts: 63,761Questions: 1Answers: 10,510 Site admin

    Hi Wyatt,

    You need to add a where() method to your PHP Editor code (assuming you are using the PHP libraries?). The documentation for that is available here.

    For example you might use:

    Editor:inst( ... )
      ->fields( ... )
      ->where( 'x', '1' )
      ->process( $_POST )
      ->json();
    

    Allan

  • wyatt121wyatt121 Posts: 9Questions: 1Answers: 0

    Hi Allan,

    Thank you for your help! Yes, I am using php libraries. Which file do I add this Editor code to?

    Wyatt

  • allanallan Posts: 63,761Questions: 1Answers: 10,510 Site admin

    Wherever the code that you are using the Editor class (table.{name}.php if you used Generator). Obviously the above is pseudo code - don't just copy and paste the whole block. It shows only where you would include the where() method.

    ALlan

This discussion has been closed.