Editor where not filtering
Editor where not filtering
borconi
Posts: 56Questions: 19Answers: 1
Hi. I'm trying to familiarize myself with Editor (quite like it till now!) but I'm having difficulties understanding what I'm doing wrong if anything.
This is my server side PHP:
<?php
// DataTables PHP library
include("./csat.php");
include( "./php/DataTables.php" );
// Alias Editor classes so they are easy to use
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Upload,
DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
$editor=Editor::inst( $db, 'job_descriptions' )
->fields(
Field::inst( 'Description' )->validator( 'Validate::notEmpty' )
);
$editor->process( $_POST );
$editor->where('owner',2,'=');
$editor->json();
It all works well, except that no matter what I change in the $editor->where('owner',2,'=');
it will still return every row from the table rather than those where the owner value is 2.
Am I doing something wrong?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Put the
where()
line before theprocess()
one.The
process()
method basically processed the setup - so everything, with the exception of thejson()
call (which gets the result of the processing) should come beforeprocess()
.Regards,
Allan
Thank you @allan!
Now I feel like a total idiot.... made sense the minute I read your comment.