I've been trying to search this, but I keep finding solutions to problems "MySQL to Multi-dimensional arrays"
I have a multidimensional array, and I'd like to use values from the array to search through my MySQL database and output whatever I need to.
Do I use WHERE
clause? IN
clause? I'm in need of some help
I have this array:
Array
(
[0] => Array
(
[id] => 333
[name] => Watches
[pluralName] => Watches
[shortName] => Watches
)
[16] => Array
(
[id] => 111
[name] => Bar
[pluralName] => Bars
[shortName] => Bar
)
)
If I have some syntax like this:
$categorySet = $dbh->prepare("SELECT c.*,ci.*,b.business_id,b.idbusiness FROM
categories c
JOIN categories_items ci ON ci.idcategory = c.idcategory
JOIN businesses b ON b.idbusiness = ci.id_items
WHERE c.id = :id OR c.name LIKE :name");
$categorySet -> bindParam(:name, $array['id']);
$categorySet -> bindParam(:name, '%'.$array['name'].'%');
$categorySet -> execute();
I'd like to search through MySQL but would like to get outputs with watches OR bars from the array.
Can someone help me?
Thank you!