To input information in a database.

Can any please help me to make corrections to this error.

import wixData from ‘wix-data’ ;

$w.onReady( function () {

//TODO: write your page related code here…
});

let userEmail;
let userName;
let userLastName;
let ticketNumber;
let booked;

let toInsert = {
“userEmail” : userEmail,
“userName” : userName,
“userLastName” : userLastName,
“ticketNumber” : ticketNumber,
“booked” : booked
};

export function SubmitBtn_click(event, $w)
{
console.log( “Submit click!!” );

userEmail = $w( “#userEmail” ).value,
userName = $w( “#userName” ).value,
userLastName = $w( “#userLastName” ).value,
ticketNumber = $w( “#ticketNumber” ).value,
booked = $w( “#booked” ).value,

if ($w( ‘#userEmail’ ).valid && $w( ‘#userName’ ).valid && $w( ‘#userLastName’ ).valid && $w( ‘#ticketNumber’ ).valid && $w( ‘#booked’ ).valid)
{
wixData.insert( “TicketChecker” , toInsert)
.then( (results) =>
{
let item = results; //see item below
console.log( “you uploaded to database!!” );
} )
. catch ( (err) =>
{
let errorMsg = err;
console.log( “your uploaded Failed!!” );
} );
}
console.log(userEmail);
}

When you hover the mouse over the red dot, what does it say? Copying and pasting the code into a page results in no errors as long as there are elements with these names on the page.

Parsing error: Unexpected Token

Try putting semi-colons instead of commas in these variable assignment lines:

 userEmail    = $w("#userEmail").value;
 userName     = $w("#userName").value;
 userLastName = $w("#userLastName").value;
 ticketNumber = $w("#ticketNumber").value;
 booked       = $w("#booked").value;

another parsing error, i will be glad if you can help me with another code that could allow me submit information into the database without being a member of the site. i mean just a visitor.

The toInsert code should have commas. Below that in the SubmitBtn_click function, those should be separated by a semi-colon rather than a comma. I know, it probably seems confusing, but the first one is assigning values to a single object to insert. The other is individual lines assigning element values to five different variables.

Thank for the help. however the challenges now is that, i am not getting the result in the database. The box are empty.