A few notes I’d like to place here:
I’d strongly recommend against using multiple queries when one is sufficient. Q1712’s SQL query would probably be the best solution for this matter, however should you want to use the IDs in an array after retrieving this list of information, then you could also use a second query:
SELECT * FROM PM30600 WHERE fldid IN ($ids)
Disclaimer: not meant to work, do some research before using queries.
Next, make a list for yourself which information from the SQL database you really want. If you query on a table that exists of 30+ columns and you only use two of them, that’s an awful waste of resources and time. Rather than using * in your query, use comma-separated lists of column names if you don’t need most or all column values. It also makes your code look cleaner and gives you more of an overview of which indexes are available without you having to look it up.