Progress Bar color change

Guys I need help I have a progress bar that is connected to the database so I want help with a code where when the data update is less than 30-39the bar should be red and when is 50-70 turn yellow and 80-100 turn green please is for my school Assignment

var myPBvalue = 30
var myPbar = $w('#progressBar1')

$w.onReady(function () {myHomeworkProgressBar()});

function myHomeworkProgressBar(){
    myPbar.targetValue = 100
    myPbar.value = myPBvalue
    if(myPbar.value >= 30 {myPbar.style.backgroundColor="red"}
    if(myPbar.value >= 50 {myPbar.style.backgroundColor="yellow"}
    if(myPbar.value >= 80 {myPbar.style.backgroundColor="green"}
}

Parsing Error on line number 9

@ashleyseokgo

var myPBvalue = 30
var myPbar = $w('#progressBar1')  

$w.onReady(function(){
    myHomeworkProgressBar();
});
   
function myHomeworkProgressBar(){
    myPbar.targetValue = 100     
    myPbar.value = myPBvalue     
    
    if(myPbar.value >=30) {myPbar.style.backgroundColor="red"}
    if(myPbar.value >=50) {myPbar.style.backgroundColor="yellow"}
    if(myPbar.value >=80) {myPbar.style.backgroundColor="green"}
}

@russian-dima sorry man i dont know where im getting it wrong but now is the same error on line 6 i really need to get this working

@ashleyseokgo
Show your current code and the error-message.

@russian-dima

@ashleyseokgo
Space between function and myHomework

function myHomeworkProgressBar(){

@russian-dima great man got it thank you very much can I connect my PBvalue so when I change from database it also changes

@ashleyseokgo
Yes you can do it.

Where do I add the database

Sorry for bothering you but I promise this is the last one I need this

@ashleyseokgo
First create a database, then take a look here onto this Velo-API…

Using a dataset:
https://www.wix.com/velo/reference/wix-dataset/dataset/getitems

Using query:
https://www.wix.com/velo/reference/wix-data/query

…to get your values out of DATABASE.