PDA

View Full Version : Need help with some HTML from PHP


11-25-2000, 12:38 AM
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.

11-25-2000, 06:30 AM
$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.

11-25-2000, 05:57 PM
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?

11-26-2000, 12:44 AM
But I need the HTML version of it.You can't generate the count with HTML. PHP is the (best) way to do it.

11-26-2000, 02:34 AM
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?

11-26-2000, 02:44 AM
You need to put in:
require("global.php");

11-26-2000, 01:38 PM
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";

?>

11-26-2000, 04:34 PM
What errors does it give you? Parse errors, or what?

-jim

11-26-2000, 04:55 PM
my guess is your path to global.php is wrong. If it can't find that file it won't work.

11-26-2000, 06:56 PM
Originally posted by JimF
What errors does it give you? Parse errors, or what?

-jim

The errors are shown above in this thread.

11-26-2000, 07:46 PM
then you are not requiring config.php properly as has also been stated above in the thread :)

11-26-2000, 08:14 PM
:confused: Has anyone else used that script successfully?

I tried several different combinations, but it ends up with the same result. :confused:

11-28-2000, 10:11 PM
That you cant do it without MySQL and PHP???? Because you said it was the *BEST* way to do it.

11-28-2000, 10:34 PM
You could do it with CGI or another scripting language, but not HTML.