And don't forget to check if $array really contains only numeric values.
Dave G wrote:
PHP Gurus, What I'm trying to do must be both common and simple, but I'm not asking the question right because I can't find the answers in Google or the online PHP manual using the search words like array, find, PHP, MySQL, etc... I have an array, and I want to select the fields in a table that match the contents of the array. The array consists of a set of user IDs. I want to find their emails from the table in a MySQL database which stores all their contact information. Sounds simple, right? Well, "SELECT email FROM table WHERE id = " . $array . ")"; isn't cutting it. I'm a total beginner, but I can understand why this doesn't work without being able to fix it. The data inside the array needs to be extracted into the set of ids it contains so that MySQL can read it. So I could run a while() loop and query the database for each id in the array, but that's obviously totally inefficient. There must be a command which handles this kind of thing. It's not explode(), it's not in_array()... I know what I'm after, but I just can't come up with the search term or phrasing which will allow a search engine to help me find it. Can someone please point me in the right direction?
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php