Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 3
Fetch number of Stars from the sql database and show them in a webpage using php.
Not only the number of starts but also show the designed stars. Exactly like ratings. Anyone ?
2 Respostas
+ 2
Well thereās alot of variations.
$query = $db->query(āSELECT raiting FROM databaseā)
$row = $query->fetch();
echo $row[āraitingā];
for($a = 0; $a < $row[āraitingā]; $a++) {
echo ā<img src=āstar.pngā />;
}
+ 3
Well, you can create function which will create stars for example:
function showStars($a){
for($i=0; $i<$a; $i++){
echo "<img src='star.png' />";
}
}
And you need to call function during getting rows from database