I have a search function that returns pk results in an array.
Is there a command to fetch those records from mysql in one go?
Or do I have to loop through the array and fetch individual records?
[SOLVED] What command to fetch primary key matches stored in
Moderator: General Moderators
you can use IN function:
Code: Select all
$query = 'select * from some_table where pk_column in(' . implode(',', $pk_array) . ')';
// then execute the query and fetch rows as usual...