LMSouq
database Open

Passing an array to a query using a WHERE clause

QU
Quinn
1 month ago
3 views
Problem Description
Given an array of ids `$galleries = array(1,2,5)` I want to have a SQL query that uses the values of the array in its WHERE clause like: <!-- language: lang-sql --> SELECT * FROM galleries WHERE id = /* values of array $galleries... eg. (1 || 2 || 5) */ How can I generate this query string to use with MySQL?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base