I've got a table named mailing_list with some basic information. The primary key is a field named 'id' (smallint, auto_increment..). Now I'm building a web-based mailer that sends a message to everyone in the table. Normally, I could just get the number of rows in the table, and try to send mail to the addresses associated with index numbers 1 through $numrows. However, people will be able to remove themselves from this list. So it's plausible that index numbers 2, 3, 4, 8, etc do not exist. Well, I don't want to be wasting queries on some IDs that don't exist.
So how can I get info from a table without using information that is contained in the table? I need to start at the top and make my way down to the bottom of the table one row at a time.
Thanks.
If you need any clarification, let me know.