从数据库到html的价值

I am a beginner to programming in PHP and HTML. I have made a progress bar in CSS and HTML which works great, but I want the pixels of the progress bar to be a value from my database. I got a database with one row and one value.

This is the code I have for the progress bar:

<div id="bar4" style="height: 50px;">
  <span style="width: 200px;"></span>
</div>

Is it possible to change the current value (the 200 in 200px) to a value from my database? I have made a PHP file which echo the value which I thought might make the process easier.

<div id="bar4" style="height: 50px;"><span style="width: <?php HERE GOES YOUR PHP CODE THAT ECHO THE 200 ?>px;"></span>

Save the file with PHP extension

you can change. Just assume, you are fetching width from database in a variable $widthVal. Then you have to use something like this

<div id="bar4" style="height: 50px;"> <span style="width: <?php echo $widthVal; ?>px;"></span>