Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81728

PHP MJoin with Where cause SQL syntax Error

$
0
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 "

Viewing all articles
Browse latest Browse all 81728

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>