Forums

How do I use 'WHERE .. IN' selector in a read data

NickOg 07 Oct, 2017
I am trying to use a WHERE .. IN selector in a read data set-up so:-

<?php
$whereConditions= getSelectedReceipts($this->data['loader']);
return $whereConditions;
?>


with this function
function getSelectedReceipts($thisDataRead) {
  foreach ($thisDataRead as $aReceipt) {
    if (!isset($receiptSelector)) {
      $receiptSelector = $aReceipt['mdlPrgReceipts']['idReceipt'];
    } else {
    $receiptSelector .= ',' . $aReceipt['mdlPrgReceipts']['idReceipt'];      
    }
  }
  $receiptSelector='7695,7684';  // This just for test purposes
  $selector=['mdlPrgReceipts.idReceipt', "$receiptSelector", 'IN'];
  return $selector;
}


I can't work out where this error arises.

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'B> ' Illegal string offset \'mdlPrgReceipts\' in <b>/hsphere/local/home/pmhu3ad' at line 1



Is that
$selector=['mdlPrgReceipts.idReceipt', "$receiptSelector", 'IN'];
correctt?


Regards

Nick
This topic is locked and no more replies can be posted.