Best to halt the actual query and echo out the result and get the sql statement and review that instead.
//$search = $this->db->exec($strSearchWhere, $arrayWhere);
Die(echo $strSearchWhere.$arrayWhere);
Does the output look like:
("SELECT * FROM tresident WHERE tresident_id=:id and tresident_first like :firstn and tresident_mobile_1 like :mobile1",array(':id'=>1, ':firstn'=>'%ja%', ':mobile1'=>'%3085%')
I’m guessing not.
// Look, this is what you have got now (WRONG!!!):
$this->db->exec(
[
"SELECT * FROM `tresident` WHERE `tresident_id` = :id AND `tresident_first` LIKE :fn"
],
[
// your $arrayWhere has the next construction which is wrong!!!
[
':id' => 'some val',
],
[
':fn' => '%val',
]
]
);
// Should be this (Correct)
$this->db->exec(
[
"SELECT * FROM `tresident` WHERE `tresident_id` = :id AND `tresident_first` LIKE :ft"
],
[
[
':id' => 'some val',
':fn' => '%val',
],
]
);
As you can see the problem is within your bind params to the SQL query string... Hope it helps you
--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To post to this group, send email to f3-fra...@googlegroups.com.
Visit this group at https://groups.google.com/group/f3-framework.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/59c876bd-935c-4be6-aec1-9dbf55de1c53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi dear abigail. Let me suggest a possible solution. Try to recognise what is the difference between the two SQL queries below:// Look, this is what you have got now (WRONG!!!):
$this->db->exec(
[
"SELECT * FROM `tresident` WHERE `tresident_id` = :id AND `tresident_first` LIKE :fn"
],
[
// your $arrayWhere has the next construction which is wrong!!!
[
':id' => 'some val',
],
[
':fn' => '%val',
]
]
);
// Should be this (Correct)
$this->db->exec(
[
"SELECT * FROM `tresident` WHERE `tresident_id` = :id AND `tresident_first` LIKE :ft"
],
[
[
':id' => 'some val',
':fn' => '%val',
],
]
);
As you can see the problem is within your bind params to the SQL query string... Hope it helps you
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-fra...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-fra...@googlegroups.com.
$string = "SELECT * FROM `artist` WHERE id = :id AND name LIKE :like";
$params = ['id' => 93,':like' => '%metallica'];
return $this->db->exec($string,$params);
However, if you still got an error do please the next. After you made your query and binded params, please add this part of code and show me the output:
print "$string\r\n"; // your main SQL query string
var_dump($aa); // you array with params
exit;
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To post to this group, send email to f3-fra...@googlegroups.com.
Visit this group at https://groups.google.com/group/f3-framework.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/a1f15935-9087-4788-9d37-eaf491610156%40googlegroups.com.
I just made this query to ensure my case.This one is absolutely correct:$string = "SELECT * FROM `artist` WHERE id = :id AND name LIKE :like";
$params = ['id' => 93,':like' => '%metallica'];
return $this->db->exec($string,$params);However, if you still got an error do please the next. After you made your query and binded params, please add this part of code and show me the output:
print "$string\r\n"; // your main SQL query string
var_dump($aa); // you array with params
exit;
//TODO: debug
print "$sWhere\r\n";
var_dump($arrayWhere);
exit;
$result = $this->db->exec($sWhere,$arrayWhere);
jsone_encode($arrayWhere);
die;
Hello Sir,sorry for late reply.
Your code does not workin too. but removing the brackets will work.
let me give a complete picture of my application.html<form><select name="tSearchfield[]"></select><input name="tSearchValue[]" ><select name="tSearchfield[]"></select><input name="tSearchValue[]" ><select name="tSearchfield[]"></select><input name="tSearchValue[]" ><button type=submit>submit</button></form>
The above html code will let user select what field to search and enter values to search. There are eleven fields to searchnow for F3 side
function residentSearchPost() {$arValuesToSearch = array();
$arValuesToSearchInWhere = [];
I am sure it has something to do with the array $arrayWhere, checking the array using print_r it should work.
I am stucked with this issue.pls helpthank youon php side route called by AJAXOn Sunday, June 16, 2019 at 1:58:56 AM UTC+3, bcosca wrote:Have you tried:$arrayWhere = Array([':tresident_first' => '%abi%',':tresident_last' => '%pat%'])
--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To post to this group, send email to f3-fra...@googlegroups.com.
Visit this group at https://groups.google.com/group/f3-framework.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/ee60e594-da44-4e35-ad68-a5f2f2e1bee9%40googlegroups.com.
Hello. Please, modify you code with this and show me what you got://TODO: debug
print "$sWhere\r\n";
var_dump($arrayWhere);
exit;
$result = $this->db->exec($sWhere,$arrayWhere);
jsone_encode($arrayWhere);
die;
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-fra...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-fra...@googlegroups.com.
["':tresident_first'"]=>
I am sure it should be
[':tresident_first']=> OR [":tresident_first"]=>
Doesn`t bother you?) Be attentive...
Let me suggest a possible solution 😎
for($i=0;$i<$inpCount;$i++) {
$arValuesToSearch[":$arSearchField[$i]"] = "%$arNewSearchValue[$i]%";
}
hello sir,here is the result
SELECT * FROM vsearchresidentinfo WHERE tresident_first LIKE :tresident_first and tresident_last LIKE :tresident_lastarray(2) {["':tresident_first'"]=>string(7) "'%abi%'"["':tresident_last'"]=>string(8) "'%patt%'"}
--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To post to this group, send email to f3-fra...@googlegroups.com.
Visit this group at https://groups.google.com/group/f3-framework.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/9280fac5-8c0e-4294-8201-d72e72972144%40googlegroups.com.