my php script save list of userid in a SESSION ARRAY variable for the purpose of creating html link on that page.
when we click that html link another PHP script should display all user information for that userid in a html table.
I need yo know best practice to create SELECT query for this
1) SELECT * from `users` WHERE
`user_id` = '$array_valuer1' OR
`user_id` = '$array_valuer2' OR
`user_id` = '$array_valuer3' OR
`user_id` = '$array_valuer4' OR
`user_id` = '$array_valuer5' OR
`user_id` = '$array_valuer6' OR
----
----
`user_id` = '$array_valuern';
2) select all user --> SELECT * from `users`
then using php script display only the userid in the SESSION array and skip other userid
which is best practice? the SESSION array is temporary and i do not to want to save in a database.
thanks
If you are storing few user ids in a session its okay. But if the number is huge dont store them in SESSION. Its better to fetch them using a query.
About the query you can use following form.