Reputation: 15
So I have this script which tells me how many users are currently on my site, and I'm trying to change the font of the text its pot but I can't seem to figure it out - (pretty new to html you can probably tell)
echo <font face="roboto" " Users Online: <i> $count_user_online </i>"</font>;
Full script:
session_start();
$session=session_id();
$time=time();
$time_check=$time-600;
$host="HIDDEN";
$username="HIDDEN";
$password="HIDDEN";
$db_name="HIDDEN";
$tbl_name="HIDDEN";
mysql_connect("$host", "$username", "$password")or die("cannot connect to server");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name WHERE session='$session'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count=="0"){
$sql1="INSERT INTO $tbl_name(session, time)VALUES('$session', '$time')";
$result1=mysql_query($sql1);
}
else {
"$sql2=UPDATE $tbl_name SET time='$time' WHERE session = '$session'";
$result2=mysql_query($sql2);
}
$sql3="SELECT * FROM $tbl_name";
$result3=mysql_query($sql3);
$count_user_online=mysql_num_rows($result3);
echo " Users Online: <i> $count_user_online </i>";
$sql4="DELETE FROM $tbl_name WHERE time<$time_check";
$result4=mysql_query($sql4);
mysql_close();
Upvotes: 0
Views: 53
Reputation: 2904
use this Add this to the head tag:
<style> .usersOnline {
font-family:roboto;
}
</style>
and then echo this too apply the font face
echo "<span class='usersOnline'> Users Online: <i> $count_user_online </i></span>";
You need to import the font in the css between the style tag though.
Upvotes: 0
Reputation: 707
You aren't closing the Font face tag like so:
echo '<font face="roboto"> Users Online: <i>'. $count_user_online .'</i></font>';
Please note that the Font tag is not supported in HTML5
http://www.w3schools.com/tags/tag_font.asp
You would instead as outlined in the comments want to use something like a span. You could then set in-line styles or the more preffered way set it in a style sheet:
echo '<span id="yourId"> Users Online: <i>'. $count_user_online .'</i><span>';
The style sheet:
#yourId {
font-face: 'roboto';
};
But if you feel you have to set it in-line
echo '<span style="font-face:roboto;"> Users Online: <i>'. $count_user_online .'</i></span>';
Upvotes: 1