Bubble SQL Connector not sending parameters to DB

Logs from server:
> 39 Query INSERT INTO EventResponses (EventID, UserID, ResidentID, Status, Timestamp)

     VALUES ('@eventId', '@userId', '@residentId', '@status', NOW())
                        39 Quit

Any recommendations?

Cheers,
Gregg

Hi :wave:t2:

Try it without the ‘ ‘.

Ex:
Use @eventId Instead of '@eventId'

Your database is SQL or MYSQL?
In sql use getdate() instead of now()

Hope it works,

Juan

Also the Parameter shows eventid2 where the query references @evenitId , lose the 2

1 Like

I removed the ’ from the and corrected the parameter to match the variable. For some reason I am now getting an error that the EventID field must not be null even though there is a value set for the test. Im using a MYSQL DB so I can use now().
Query:

Response:

Thank you for the suggestions!

Make sure there are no untoward spaces in either the query or the parameter

I’ve got a similar issue - so please let me know if you have managed to solve this.

I removed all the spaces from the query but I am still getting the error that the ID field is null.

I tried another table in my DB just to see if I could reproduce the issue and I was able to. This time I have two text field with parameters before my required ID field and got the same null value error.
Table 1:


Table2:

I verified these will validate if I hardcode the values but there seems to be something with setting number parameter for required fields. I have filled a bug with Bubble and it appears to be the only bug on the docket :slight_smile: I will post if I there is a resolution from bubble.

Any other suggestions are also welcome. I will experiment and report back.

Cheers,
Gregg

Have you tried changing the type from number to text?

MySQL uses question marks as parameters, not “@”. You also need the parameters in the exact order as the Insert field names as the parameters replace each question mark in sequential order. Try this:

insert into EventResponses(EventID, UserID, ResidentID, Status, Timestamp)
values (?, ?, ?, ?, now());

Then put your parameter list in this order. Number or text should both work:

$1 Name EventID
$2 Name UserId
$3 Name ResidentID
$4 Name Status

4 Likes

Thank you @joeyg ! Now I can now add records to MYSQL DB :slight_smile:

Did you manage to add records manually or from the fields in Bubble?