Code for a lottery

Hi, i got this so far but somehow it doesnt work.

import wixData from 'wix-data';

$w.onReady(function () {
 //
  $w('#button25').onClick(() => {
 const value = $w('#input6').value;
    wixData.query('UrunTakibi')
    .eq('title', value)
    .find()
    .then((foundItem) => {
 let prize = foundItem.items[0].prize;
        $w('#text69').text = prize;
 
    })
});
});

Everytime i run my code i got this error;

Wix code SDK Warning: The text parameter of "text69" that is passed to the text method cannot be set to null or undefined.

i cannot find out my i am missing. This is my code, I tried several alternatives but they all failed. Thanks in advance for the help.

1 Like

Your query is probably not returning any items. You need to be sure that your database collection has the records that you are expecting. You can try a console.log(foundItem.items) to see what’s being returned.

Actually, its filled with some items but still doesnt return any items.

What shows up in the console.log() statements?