PHP MJoin with Where cause SQL syntax Error

PHP MJoin with Where cause SQL syntax Error

HassanDomeDeneaHassanDomeDenea Posts: 29Questions: 10Answers: 0

Greetings
I'm using PHP Datatable Library 1.9, and everything is fine.
Today I tried to use Mjoin as usual, but this time I have to do furhter conditioning by adding where.
and I got the error:

error: "SQLSTATE[HY000]: General error: 1 near "ANDinvsresults": syntax error"

It seems that the where statment do not add space here.
Is it something wrong in my usage, or a bug in editor library? and where exactly I can correct it ?
I used composer to require datatabel:

{
    "require": {
        "datatables.net/editor-php": "1.9"
    }
}

And here is my php code:

$editor->join(
                \DataTables\Editor\MJoin::inst('files_list', 'okey_id')
                    ->link('files_list.belong_to','invsresults.key_id')
                    ->order('created_at desc')
                    ->fields([
                        Field::inst('key_id'),
                        Field::inst('type'),
                        Field::inst('belong_to'),
                    ])
                    ->where('files_list.type', 'invResult','=')
            );

And here is the query when I enabled the debug:

query: "SELECT DISTINCT  invsresults.key_id as 'dteditor_pkey', files_list.key_id as 'key_id', files_list.belong_to as 'belong_to' FROM  invsresults as invsresults  JOIN files_list ON files_list.belong_to = invsresults.key_id WHERE files_list.type = :where_0 ANDinvsresults.key_id IN (:wherein1, :wherein2, :wherein3, :wherein4, :wherein5, :wherein6, :wherein7, :wherein8, :wherein9, :wherein10)  ORDER BY created_at  desc "

This question has an accepted answers - jump to answer

Answers

  • HassanDomeDeneaHassanDomeDenea Posts: 29Questions: 10Answers: 0

    I just upgraded to PHP Editor 1.9.2 and the problem is fixed.

  • allanallan Posts: 61,741Questions: 1Answers: 10,111 Site admin
    Answer ✓

    Thanks for the update - yes, I was going to say that the issue you found there was fixed in 1.9.1 I think.

    Allan

This discussion has been closed.