So actually what Im trying to do is creating a counter, which will show the number of the Rows of a Database. (On my Website a kind of counter for messages from people)
So the ID of the Database is like you can see the jobapplication07 and I already imported the wix data. But everytime the textbox(#text12) just still show 0 even if there are already 24 Rows. I hope someone can help me out with that ;)
Your first MISTAKE is the ----> # <------
RIGHT:
wixData.query('HereYourDatabaseID')
Complete-Code:
import wixData from 'wix-data'; $w.onReady(()=> { wixData.query('HereYourDatabaseID') .find() .then((res)=>{let items = res.items; if (items.length>0) {console.log("Some items found!!!"); console.log(items); console.log("First-Item: ", items[0]); console.log("First-Item-Title: ", items[0].title); $w('#text12').text = items.length; } else {console.log("No items found!!!");} }) .catch((err)=>{console.log(err);}); });
Nevermind I fixed it. Just changed the items length variable to a string. Thanks for your help Velo Ninja!!! Appreciate it bro ;)