I can’t figure out why I am receiving the following error Notice: Array to String conversion in ‘path’ line 462. Below is the code for line 462.
public function fetchOneBrg(array $conditions){
$db = Core::getInstance();
$sql = "SELECT * FROM ".USERS_BRG." WHERE ";
$params = array();
$i=0;
foreach ($conditions as $column => $value) {
if (preg_match('/^[a-z-.-_]+$/', $column)) {
if($i !=0){
$sql .= " AND ";
}
$sql .= "$column = ?";
$params[] = $value;
$i++;
}
}
$res = $db->dbh->prepare($sql);
Line 462: $res->execute(array_values($params));
return $res->fetch(PDO::FETCH_ASSOC);
$ststres = $db->dbh->prepare("SELECT * FROM ".USERS_STATS." WHERE user_id = :uID ORDER BY id DESC LIMIT :zero, :forty");
$ststres->bindParam(':uID',$udata['id'],PDO::PARAM_INT);
$ststres->bindValue(':zero',0,PDO::PARAM_INT);
$ststres->bindValue(':forty',40,PDO::PARAM_INT);
$ststres->execute();
$ststres=$ststres->fetchAll(PDO::FETCH_ASSOC);
I suspect it is the code above being passed in as a string to during the call array([‘id’=>$ststres[ststval].to_id] below in Smarty. Doing a var_dump returns strings in array. How to resolve this and why is the string conversion happening on the ID’s?
This is the call to the function:
{assign var=‘brgdatas’ value=$brgObj->fetchOneBrg(array([‘id’=>$ststres[ststval].to_id]))}
Thank you for your help.