Complete Guest Creation SQL

Sample Data:

Name: Johnathan Duggan

Handicap: 5.6

Gender: M

EventId: 1

Observaciones: Test observation

Teebox: 56

Step 1: Insert Guest Record

INSERT INTO Guests (name, handicap, handicapDec, email, federation, createdAt, updatedAt, EventId, Gender) VALUES ('Johnathan Duggan', '5.6', '5.6', '', '0', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '1', 'M')

Step 2: Get the Guest ID

After running the above SQL, get the inserted ID:

SELECT LAST_INSERT_ID() as guest_id;

Step 3: Insert EventUsers Record

Replace 'GUEST_ID_HERE' with the actual guest ID from step 2:

INSERT INTO EventUsers (flight, tee, observations, waitlist, guest, createdAt, updatedAt, UserId, EventId, GuestId, teebox, Seqno, places, starter, main, desert) VALUES ('0', '1', 'Test observation', '0', '1', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL, '1', GUEST_ID_HERE, '56', NULL, NULL, 'zzzzz', 'zzzzz', 'zzzzz')

Complete PHP Code:

Key Points:

To test manually in phpMyAdmin:

1. Run the guest insert SQL

2. Note the guest ID that was created

3. Run the EventUsers insert SQL with the correct guest ID

4. Check that both records are created correctly