Closed tmuks closed 8 years ago
Hi tmuks,
the code
if(strstr(key($aWhere), ' ')){
has two methods, first it is strstr to check whether a space exists or not in keys which is getting by key as second method.
Lets have a example:
$q = $db->select ( 'customer', 'fname, lname', array (
'lname =' => 'Mikey',
'or fname =' => 'Scott'
), 'ORDER BY fname' )->results ();
As you see I am passing'lname =' => 'Mikey', with where clause array to execute multiple where clause. When user pass space where array key then it means they want to execute multiple where clause.
Thanks for your reply
My question is how can you use string function on array? Please check following query, is it works? $q = $db->select ( 'customer', 'fname, lname', array ( 'lname >=' => 'Mikey', 'or fname >=' => 'Scott' ), 'ORDER BY fname' )->results ();
Yes, tmuks.. it will work. It will create query
NOTICE: Executed Query ->
SELECT fname, lname FROM `customer` WHERE lname >= "mikey" OR fname >= "scott" ORDER BY fname;
look once what happening key getting the first array key as string and strstr finding space exist or not in array key (only first array key). So, I am using a strstr function with string..:)
See line no near 389: if(strstr(key($aWhere), ' ')){
$aWhere is array how can you compare with string function. this issue is present throughout class in all functions.
And if you add operators like '>' in array('field >'=>$val) will return an error