View Full Version : Need help with some HTML from PHP
What is the script to make it so that it says how many users and guests are online and who? I need this in HTML.
$mysql_result = mysql_db_query("database", "select count(sessionid) from session", $mysql_link);
$numonline = mysql_fetch_array($mysql_result);
echo "$numonline";
Next time user the seach.
But I need the HTML version of it. I might try to put it on my webpage. Or would I put something like this:
<Script Language=PHP 4.4>
$mysql_result = mysql_db_query("database", "select count(sessionid) from session", $mysql_link);
$numonline = mysql_fetch_array($mysql_result);
echo "$numonline";
</script>
Would That Work?
But I need the HTML version of it.You can't generate the count with HTML. PHP is the (best) way to do it.
Originally posted by Menno
$mysql_result = mysql_db_query("database", "select count(sessionid) from session", $mysql_link);
$numonline = mysql_fetch_array($mysql_result);
echo "$numonline";
Next time user the seach.
I tried testing the script provided above and it gave me this error!
Warning: Supplied argument is not a valid MySQL-Link resource in D:\Inetpub\wwwroot\forums\userstest.php on line 2
Warning: Supplied argument is not a valid MySQL result resource in D:\Inetpub\wwwroot\forums\userstest.php on line 3
Any ideas what the problem may be?
You need to put in:
require("global.php");
This is the exact code I am using, but still get the same errors. I changed the name of the database to my test vb, but still no luck.
<?php
require("global.php");
$mysql_result = mysql_db_query("database", "select count(sessionid) from session", $mysql_link);
$numonline = mysql_fetch_array($mysql_result);
echo "$numonline";
?>
What errors does it give you? Parse errors, or what?
-jim
my guess is your path to global.php is wrong. If it can't find that file it won't work.
Originally posted by JimF
What errors does it give you? Parse errors, or what?
-jim
The errors are shown above in this thread.
then you are not requiring config.php properly as has also been stated above in the thread :)
:confused: Has anyone else used that script successfully?
I tried several different combinations, but it ends up with the same result. :confused:
That you cant do it without MySQL and PHP???? Because you said it was the *BEST* way to do it.
You could do it with CGI or another scripting language, but not HTML.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.