Ask the PHP array as the MySQL query condition where xx in array, how to handle
Originally think of the array $customerid split out, to determine the length of different variables, the number of variables to be judged, and then write the bottom of the MySQL query, some trouble, ask there is no good way, thanks!
$customer->where ("id in". $customerid)->count (); That's the point, of course, it's not right to put the array directly here.
------to solve the idea----------------------
The first question, if it is to check the single ID, the direct id = XX can be, no need to use in
If you want to check multiple IDs, combine the array with the IMPLODE function into the ID in (1, 2, 3) string of this format
The last question, if your requirement is to output a list of users, and output each of the top 10 favorites, you should consider caching
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.