Can't get search results from my Code

I m triing to build a website for my work
i want to connect number input to search in CMS data collection

i tried with chatGPT and helped my with coding with no errors

but on preview I didn’t get any results

Any one Can Help ???

import wixData from ‘wix-data’;

$w.onReady(function () {
// Add an event handler for the button click
$w(“#searchkey”).onClick(() => {
// Get the value from the text input
let inputValue = $w(“#certnum”).value;

    console.log("#certnum", inputValue);

    // Query the CMS collection based on the input value
    wixData.query("ResultsVarification")
        .eq("certificateId", inputValue) // Removed the # from the field name
        .find()
        .then(results => {
            console.log("#resultbox", results);
            // Check if there are any matching results
            if (results.items.length > 0) {
                // Display the data in the text box
                let matchingItem = results.items[0];
                $w("#nameresult").text = matchingItem.title;
                $w("#courseresult").text = matchingItem.itemPageText;
                $w("#issueresult").text = matchingItem.altText;
                $w("#renewresult").text = matchingItem.dateForUpdateExpiry;
            } else {
                // Handle the case where no matching data is found
                $w("#nameresult").text = "Check";
                $w("#courseresult").text = "Entered";
                $w("#issueresult").text = "Certificate";
                $w("#renewresult").text = "No matching data found";
            }
        })
        .catch(err => {
            console.error(err);
        });
});

// Add an event handler for the reset button click
$w("#resetkey").onClick(() => {
    // Call the function to reset text fields
    resetTextFields();
});

});

// Function to reset text fields
function resetTextFields() {
$w(“#certnum”).value = “”; // Clear the text input
$w(“#nameresult”).text = “”;
$w(“#courseresult”).text = “”;
$w(“#issueresult”).text = “”;
$w(“#renewresult”).text = “”;
}

import wixData from 'wix-data';

const DATABASE = 'ResultsVarification';

$w.onReady(()=> {
    $w('#searchkey').onClick(()=> {
        let inputValue = $w('#certnum').value;  console.log('#certnum', inputValue);
        searchData(inputValue);
    });
    $w('#resetkey').onClick(()=> {resetTextFields();});
});


function searchData(inputValue) {
    wixData.query(DATABASE)
    .eq('certificateId', inputValue).find()
    .then((res)=> {console.log('RESULTS: ', res);
        if (res.items.length > 0) {console.log('Some DATA found!!!');
            const item = res.items[0]; console.log('ITEM: ', item);
            const itemTitle = item.title; console.log('Item-Title: ', itemTitle);
            const itemPageText = item.pageText; console.log('Item-PageText: ', itemPageText);
            const itemAltText = item.altText; console.log('Title: ', itemAltText);
            const itemExpirityDate = item.dateForUpdateExpiry; console.log('Title: ', itemExpirityDate);
           //--------------------------------------
            $w('#nameresult').text = itemTitle; 
            $w('#courseresult').text = itemPageText;
            $w('#issueresult').text = itemAltText;
            $w('#renewresult').text = itemExpirityDate;
        } else {console.log('No DATA found!!!');
            $w('#nameresult').text = 'Check';
            $w('#courseresult').text = 'Entered';
            $w('#issueresult').text = 'Certificate';
            $w('#renewresult').text = 'No matching data found';
        }
    }) .catch((err)=> {console.error(err);});
}


function resetTextFields() {
    $w('#certnum').value = '';
    $w('#nameresult').text = '';
    $w('#courseresult').text = '';
    $w('#issueresult').text = '';
    $w('#renewresult').text = '';
}

Your code looks not that bad.
Test this one and check all logs.

My assumtion would be → maybe you are using a DATASET ???
If so → did you wait until your dataset got —> READY ??? →

$w('#myDataset').onReady(()=>{..............................});