I am making panels which fills up green "row" from online @ database. Here is css im using to draw everything, does not cause any errors.
<style>
.one {
width: 1px;
height: 12px;
display:block;
float:left;
background-color: green;
}
.three {
width: 3px;
height: 12px;
display:block;
float:left;
background-color: green;
}
.five {
width: 5px;
height: 12px;
display:block;
float:left;
background-color: green;
}
.ten {
width: 10px;
height: 12px;
display:block;
float:left;
background-color: green;
.thirty {
width: 30px;
height: 12px;
display:block;
float:left;
background-color: green;
}
.fifty {
width: 30px;
height: 12px;
display:block;
float:left;
background-color: green;
}
</style>
And there's PHP code which connects to sql.. checks players and draws a css.
<?php
define('mySQL_hostname', 'IP'); //
define('mySQL_database', 'DB'); //
define('mySQL_username', 'US'); //
define('mySQL_password', 'PW'); //
//connects to mysql
$db_link = mysql_connect( mySQL_hostname, mySQL_username, mySQL_password )
or print( 'SQL_CE' );
//connects to Db
$db_select = mysql_select_db( mySQL_database, $db_link )
or print("SQL_DB");
//selects table
$chars= mysql_query("SELECT `online` FROM `users` where `online`=1");
$rows = mysql_num_rows($chars);
// $rows = counted players... which prints out number.
if ($rows <= 1) {
print '<span class="one"></span>';
}
else if ($rows >= 50) {
print '<span class="three"></span>';
}
else if ($rows >= 150) {
print '<span class="ten"></span>';
}
else if ($rows >= 300) {
print '<span class="ten"></span>';
print '<span class="ten"></span>';
}
else if ($rows >= 500) {
print '<span class="thirty"></span>';
print '<span class="one"></span>';
}
else if ($rows >= 700) {
print '<span class="ten"></span>';
print '<span class="thirty"></span>';
print '<span class="three"></span>';
}
else if ($rows >= 900) {
print '<span class="ten"></span>';
print '<span class="five"></span>';
print '<span class="thirty"></span>';
}
else if ($rows >= 1000) {
print '<span class="thirty"></span>';
print '<span class="thirty"></span>';
print '<span class="three"></span>';
}
else if ($rows >= 1200) {
print '<span class="fifty"></span>';
print '<span class="ten"></span>';
print '<span class="ten"></span>';
print '<span class="five"></span>';
}
else if ($rows >= 1400) {
print '<span class="fifty"></span>';
print '<span class="thirty"></span>';
print '<span class="five"></span>';
}
else if ($rows >= 1600) {
print '<span class="fifty"></span>';
print '<span class="fifty"></span>';
}
else if ($rows >= 1800) {
print '<span class="fifty"></span>';
print '<span class="fifty"></span>';
print '<span class="ten"></span>';
}
else if ($rows >= 2000) {
print '<span class="fifty"></span>';
print '<span class="fifty"></span>';
print '<span class="thirty"></span>';
}
else if ($rows >= 2200) {
print '<span class="fifty"></span>';
print '<span class="fifty"></span>';
print '<span class="thirty"></span>';
print '<span class="ten"></span>';
}
else if ($rows >= 2500) {
print '<span class="fifty"></span>';
print '<span class="fifty"></span>';
print '<span class="fifty"></span>';
}
else {
echo "Script error"; // this place i got printed out.
}
?>
So the thing i get is... "script error" from bottom of doc. Did i misspelled something or what?