To do this you need to compile PHP as a CGI not as an Apache module.
compile PHP with the following:
configure --without-apache ...
This will result in an executable named php that you'll run like :
php script.php
This will work in crontab but is not the prefered way.
Consider using a shell script or a native MySQL script.
I'm not a MySQL expert but with a shell script and Oracle you could do:
-----8<----------8<----------8<-----
#!/bin/sh
Do the query and save the result in a file
sqlplus uid/pwd@db <<-EOF > output.txt
SELECT email
FROM email_table;
exit
EOF
#Then process your output file
for email in cat output.txt; do
Message contains the message you want to send
cat message | sendmail -s "Your bill" $email
done
rm -f output.txt
-----8<----------8<----------8<-----
Save this in a file
do a chmod +x on it
and add it to crontab
That's just an example of what can be done and you're free modify to suit your needs.
You must do the difference between jobs for Apache and jobs for the system and choose the best way to achieve it.
Hope this helps
JBL