Link to home
Start Free TrialLog in
Avatar of Russelauto
RusselautoFlag for United States of America

asked on

Insert multiple rows based on number of clients from another table

Using php and mysql,

I have a table called "certificates" and another table called "clients". I'd like to issue a certificate to every client in the database based on the existance of their user_id within the client table.

Basic logic being

Grab all unique user_ids from table clients

Insert into certificates the certificate value (from POST data) and a new row for every unique user_id

So the end result is if there are 10 user_ids in clients, 10 certificates will be issued... 1 for each client. I do store the user_id in the certificate table for obvious reasons.
ASKER CERTIFIED SOLUTION
Avatar of nasirbest
nasirbest
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Russelauto

ASKER

Thank you for your quick response.