Random picture with corresponding data from database on a dynamic page

Hi Kristof,
thanks for the interest! Yes the database is only one with multiple colums (image, answer) and rows.
This is the code I have for the moment. They are actually very amateurly joined two ideas together, so I guess there will be the problem… And one more thing: For the moment I don’t have the “next word” button.

$w.onReady( function () {
});
function check_answer(inputVal, answerVal, resultEl) {
if (inputVal.toLowerCase() === answerVal.toLowerCase()) {
resultEl.text = “correcto” ;
} else {
resultEl.text = “incorrecto” ;
}
}
export function button1_click(event) {
check_answer($w( “#input1” ).value, $w( “#text2” ).text, $w( “#text1” ));
}

import wixWindow from ‘wix-window’ ;
import wixData from ‘wix-data’ ;

$w.onReady( async function () {

if (wixWindow.rendering.renderCycle === 1 ) {
let res = await wixData.query( “vocabulary” ).find();
let items = res.items;
let count = items.length;
let rnd = Math.floor(Math.random() * count);
$w( ‘#image1’ ).src = items[rnd].image; }
});
wixData.query( “vocabulary” )
.find()
.then( (results) => {
let randomNumber = Math.floor((Math.random() * results.items.length));
let randomItem = results.items[randomNumber];
})