A
A
Andrei St2017-02-19 01:17:43
PHP
Andrei St, 2017-02-19 01:17:43

How to display the number of accounts in the form of a bar from a mysql table?

Tell me how to display the number of registered accounts from the mysql table as a progress-bar?
tried

mysql_connect ("$dbip:$dbport","$dblogin","$dbpass"); 
mysql_select_db("$db") or die ("Нет соединения с базой $db");
$acc = mysql_query ("select count(*) from rp4_admin");
$acc = mysql_result ($acc,0);
mysql_select_db ("$db");
echo "Зарегистрировано:: $acc<br>";
echo "<div class='progress'>
<div class='progress-bar' role='progressbar' aria-valuenow='60' aria-valuemin='0' aria-valuemax='100' style='width: <?php echo $acc; ?>%;'>
</div>
</div>"

doesn't work, can anyone help?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
totosarg, 2017-02-19
@totosarg

What exactly doesn't work? bar not showing? I don't know what your css looks like, but most likely you have a typo and not aria-value... probably it should be area-value...
You already have a php script, why are you doing <?php echo ?> a second time? it will probably work like this:

mysql_connect ("$dbip:$dbport","$dblogin","$dbpass"); 
mysql_select_db("$db") or die ("Нет соединения с базой $db");
$acc = mysql_query ("select count(*) from rp4_admin");
$acc = mysql_result ($acc,0);
mysql_select_db ("$db");
echo "Зарегистрировано:: $acc<br>";
echo "<div class='progress'>
echo "Зарегистрировано:: $acc<br>";
echo "<div class='progress'><div class='progress-bar' role='progressbar' aria-valuenow='60' aria-valuemin='0' aria-valuemax='100' style='width: ".$acc."%;'></div></div>";

A
Andrey Burov, 2017-10-20
@myrecs

eval is changed to echo and some formatting.https://pastebin.com/i6jqZHcD

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question