Hi there, i am writting a PHP - MySql app the basic idea of which is to maintain a database of employees and details about them (eg. which dept & group they are in). The when the person who is ment to be lecturing them for staff training is not in all of the people affected by it are sent an SMS message (via http to clickatell.com). So far all of it is working and i can pull out all of the affected people using this SQL query
"$query="SELECT employee.firstname, employee.lastname, employee.id, employee.group, depthead.course, lectures.starttime, lectures.option, lectures.module, lectures.endtime, employee.mobile FROM employees, lectures WHERE emplyee.course = lectures.course AND employee.group = lectures.group AND lectures.lecturer = '$staffName' AND lectures.day = '$dayDate' ORDER BY employee.firstname ASC";"
Dont worry if that seems confusing becuase it is not that important. The problem comes when the SMS messages need sending. Only 100 SMS messages can be sent per http call to clickatell.com. So if i need to send more than that then i need to split up the response in groups. I know that this can be done using the LIMIT command from MySQL but also the other issue is that different messages need to be send to different groups so.......... the question that i am asking is i guess how is it possible to pull out the mobile numbers of the people from the different groups that they are in without writing a load of different SQL queries. I already have the whole list of affected people using the above query but somehow i need to split this up again so that different SMS messages can be sent to the different groups and with no more that 100 people in each split section. I was told on another forum that this can be done using the GROUP BY command in MySQL and then formulating some kind of array. Please Please can sombody help me out. If the above is kind confusing i would be happy to clear any points up. It is a kinda complex problem and i didnt really want to be writting a whole essay about it.
Thanks for your time
Regards
Alex Shaw