close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

MysqlI Search Question - using Comma Sepeated List

Thread began 2/24/2019 8:24 am by Dave Buchholz | Last modified 2/26/2019 9:09 am by Dave Buchholz | 781 views | 5 replies

Dave BuchholzBeta Tester

Mysqli Search Question - using Comma Seperated List

Is there a way to convert this code to work in the MySQLi Search Behaviour so that I can add other dynamic parameters to determine which saved products should be displayed.

<?php 
$products_cookie = json_decode($_COOKIE['compare-products'], true);
$allKeys = array_keys($products_cookie); // see https://stackoverflow.com/a/4095810/175553
$allKeys = str_replace('ITEM-','',$allKeys); // see https://stackoverflow.com/a/4977085/175553
$productIDCollection = implode(',',$allKeys);
?>
<?php
$rsDataSet = new WA_MySQLi_RS("rsDataSet",$connMySQLi,0);
$rsDataSet->setQuery("SELECT p.* FROM tbl_products AS p WHERE p.id IN(?)");
$rsDataSet->bindParam("il", "".$productIDCollection ."", "-1"); //commaDelimitedList
$rsDataSet->execute();
?>



When I add a search to this recordset it removes the existing where clause which I know is expected behaviour.

$allKeys

is an array that could be used but when I try and pass it in I get the following error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 78 bytes) in /Users/davidbuchholz/Sites/***/wwwroot/webassist/mysqli/rsobj.php on line 195



The array looks like this:

Array
(
[0] => 1481
[1] => 1480
)



when I do

print '<pre>';
print_r($allKeys);
print '</pre>';



Thanks.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...