What is the correct format for where with in and or?
What is the correct format for where with in and or?

In my MySQL table field the data may look something like:
99999
88888:33030
33030:66666:11111:10001
14701
10000:99999
10000
77777
Always 5 digits. A simple where:
->where( 'box_id','66666','=' ) // works fine
I need to add an or so I try:
->where( 'box_id','66666','=' )
->or_where( 'box_id','12345','=' )
When I add the or_where it causes the table to error out with the standard error popup message and not load any data.
Another way to solve the problem might be with a mysql IN as in:
where box_id in (66666,12345)
How would you set up datatables IN (or NOT IN) syntax?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
https://datatables.net/forums/discussion/43542
Back to the or_where, a common mysql query would look like:
or perhaps
if there are other conditions.
Regarding the "IN" clause I saw that other post before I posted the question but didn't understand what it was conveying.
Just to see if the IN works I tried the syntax referenced in the post, 43542.
also tried:
In both cases it failed with a popup error like:
DataTables warning: table id=example - An SQL error occurred: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''(10000,2,3)'' at line 1
Oops my bad,
$q->where( 'box_id', '(1000,6,5)', 'IN', false );
This works. I missed the underscore in box_id. That leaves getting the OR format working.
In the real table all the ids, box_id's will have 5 digits, not like what I just tested.
Can you show me your PHP code (the full Editor instance) when you are using the
or_where()
method please?Thanks,
Allan
Right - there is no
Editor->or_where()
method (the API documentation is here). You need to do this instead:Allan
I get basic php/mysql but api documentation especially javascript is a challenge. I do much better mirroring directly off examples like your examples page, then making incremental changes. I'm sure that I'm not alone in my skills. With the above usage example I have it working. Tx.