>>  Site Map >>  Forums >>  Blocks 7x

Forum module - topics in forum:



Blocks 7x - Discussions regarding PHP-Nuke Blocks. 7x



What is the best way to change this into a block?

I have the following...


Code: :
 <? // script by Bob Dickow for displaying number of phpMyChat users//    in a web page display./* This script may be run as an include (place a php include();) or included in your php script or php enabled html web pages. Place it at the location youwant the message displayed.*//* Change the data for your login, and double check that the 'c_users', 'c_messages' table names are the ones you are really using. (To find out,look in config/config.lib.php3 on your running system and match the tablenames. *//* This does not use the dbase abstraction libraries in phpMyChat, justso you can have more flexibility with how and where you use this. */

$mysql = mysql_connect ("db1.xxxx.et","dXXXXX",".eXXXXX4");  $dbase = mysql_select_db("dXXXXXX0");  $query = "SELECT DISTINCT u.username FROM ooc_c_users u, ooc_c_messages m WHERE u.room = m.room AND m.type = 1";  $result = mysql_query($query);  $num_of_rows = mysql_num_rows($result);  mysql_close($mysql);  echo ("<BR>Currently $num_of_rows user in the chat room<BR>");?>



Working perfectly if I put it in a php file and directly access it. What it does is that it will display the current number of user in a chat room. However, I have a hard to displaying it properly in a block.

If I put the file as a block-usercount.php in the block directory, it will display "Currently 8 user in the chat room" on TOP of the block, with that "no content notice" inside the block, and any other content I put in there doesn't seem to effect the block itself. The block will ignore any link. (I'm supposed to put a link to the chat room within the block).

How should I do this to make the block display the user number in the chat room correctly? I am new to this php thing. and I'm sure I did something wrong






http://phpnuke-uk.net/modules.php?name=PHP-Nuke_Tools&file=index&func=Block






Believe it or not. I have tried that before and it does not work. >_<

All it say in the content is

Code: :
 Currently user in the chat room
");?>


I'm suspecting I have some codding error I over looked. Here is the code in the block-usercount.php

Code: :
<?php
#### Generated by Block Creator by Disipal Site (www.disipal.net) ###
if (eregi("block-Block_Creator.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
$content  =  " <? // script by Bob Dickow for displaying number of phpMyChat users//    in a web page display./* This script may be run as an include (place a php include();) or included in your php script or php enabled html web pages. Place it at the location youwant the message displayed.*//* Change the data for your login, and double check that the 'c_users', 'c_messages' table names are the ones you are really using. (To find out,look in config/config.lib.php3 on your running system and match the tablenames. *//* This does not use the dbase abstraction libraries in phpMyChat, justso you can have more flexibility with how and where you use this. */";
$content  .= "$mysql = mysql_connect (\"dbXXXXXXet\",\"dXXXXXXX0\",\".eXXXXXX4\");  ";
$content  .= "dbase = mysql_select_db(\"dXXXXXXX0\"); ";
$content  .= "query = \"SELECT DISTINCT u.username FROM ooc_c_users u, ooc_c_messages m WHERE u.room = m.room AND m.type = 1\";  ";
$content  .= "result = mysql_query($query);  ";
$content  .= "num_of_rows = mysql_num_rows($result);  mysql_close($mysql);  ";
$content  .= "cho (\"<BR>Currently $num_of_rows user in the chat room<BR>\");?>";
?>


Do anyone know what is wrong at all?




Attention! You are currently viewing sitemap page!
We strongly suggest to look at original content

Search from web

Valid HTML 4.01 Valid CSS