I have table messages where I am trying to create new messages to users. Algorythm looks like:

1) Get all user e-mails (they act as user id and is primary key in table user)

2) For each e-mail insert message (same to all), flag is read (false) and time (NOW())

How to do this? I wrote next, but I am sure that such line is wrong.

```
INSERT INTO `messages` (`email`, `message`,`isread`,`createdat`) SELECT DISTINCT `email` FROM `users`, ?, false, NOW()

```

P.S. I am doing this via PHP, so ? will be message text.
For messages primary key is id that is AUTO\_INCREMENT. Database: MySQL