DataTables warning: table id=schedule_socialmedia - SQLSTATE[42S22]: Column not found: 1054 Unknown
DataTables warning: table id=schedule_socialmedia - SQLSTATE[42S22]: Column not found: 1054 Unknown
Hi Allen
Sorry about opening a new thread since I closed last one as below, but this is a new issue.
http://datatables.net/forums/discussion/25049/issue-about-sql-select
Editor where() working fine with single SQL where condition
But when I trying to make two conditions like SQL below, where() function is not quite right. ( I have read API and trying to use array as parameter, but still failed)
SQL:
select ...... from ..... where DATE_FORMAT(time,'%Y\-%m\-%d') = "2014-12-12" AND media_type = "facebook"
the code I am using:
->where( array("DATE_FORMAT(time,'%Y\-%m\-%d')", "media_type"), array("2014-12-12","facebook") )
for single condition as below, it is working.
->where("DATE_FORMAT(time,'%Y\-%m\-%d')",$time)
I also try this , but not working as well
$key = array("message","media_type");
$value = array("today weathere","facebook");
$op=array("=","=");
->where( $key,$value,$op)
based on your document on line 360
http://editor.datatables.net/docs/current/php/source-class-DataTables.Editor.html#356
conditions to use: where( array('fieldName', ...), array('value', ...) );
don know why it is not working.
This question has an accepted answers - jump to answer
Answers
You should be able to simply call the
where()
method twice and it will add the queries together automatically with AND:Allan
Yes I read other thread to find out this.
But I just wondering know what's the array in parameter used for?
where( array('fieldName', ...), array('value', ...) );
Could you point me to where in the documentation it says that an array can be used for the Editor class's
where()
method. It shouldn't (and doesn't in the API docs).Thanks,
Allan
Allan: it's in the comment block for the where() method.
http://editor.datatables.net/docs/current/php/source-class-DataTables.Editor.html#356
At least you know somebody reads the comments....
Got it - thanks! That comment is nonsense. I'm going to package up a new beta of Editor 1.4 today, and I'll get this sorted out for that.
Thanks for flagging it up!
Allan