Page 1 of 1

Notification sistem

Posted: 2020-11-23 23:29
by fciprian
Hello
I try to make a notification sistem.
I have made a table with Name and E_mail and a CHECKBOX:
Emil [email protected]
I have added the automatically email sending code after insert to /hooks folder to the table file and at email recipients i put $notifications
When i check the box it is 1 in the db. So i search like this :

Code: Select all

$notifications =sqlValue("SELECT E_mail FROM Notifications where CHECKBOX='1'");
When i have only one line with one email it works. When i check the box it is sending the email and when i disable the box it does not send the email.

The problem is then i have 2 or more lines with emails:
Emil [email protected]
Marius [email protected]
Ema [email protected]
So i need to request: [email protected], [email protected], [email protected]
I have tryed with :

Code: Select all

$notifications =sqlValue("SELECT E_mail,+', ' FROM Notifications where CHECKBOX='1'");
but no luck...

Can anyone help me with the corect $notifications request? i need to recive [email protected], [email protected], [email protected] from the request.

Thank you.

Re: Notification sistem

Posted: 2020-11-26 15:11
by ksabra
Query mail inside array
After that, to send a message to everyone, use foreach and put mail in it
To prevent the mail addresses of the other recipients from appearing

Re: Notification sistem

Posted: 2020-11-26 18:49
by pbottcher
Try

Code: Select all

select group_concat(E_mail) from Notifications where CHECKBOX='1' group by CHECKBOX

Re: Notification sistem

Posted: 2020-11-27 00:07
by fciprian
That was perfect!

Thank you very much! I appreciate