dimiandre
02-28-2012, 06:16 PM
hi all,
i have added a new widget in my vbulletin cms. It's a "direct execution widget"
in it i have an Mysql query that return counts of some rows in my database..
but sometimes it returns nothing :S
i have tryed to run the query manually from "phpmyadmin" and the query itself works
this is the code of my widget:
require_once("mysql_vars.php");
$conn_widget = mysql_connect($host, $user, $pass);
mysql_select_db($characters, $conn_widget);
$result_wid = mysql_query("SELECT Count(Online) FROM `characters` WHERE `online` = 1", $conn_widget);
$row_wid = mysql_fetch_array($result_wid);
$online_wid = $row_wid["Count(Online)"];
if (!$sock = @fsockopen("127.0.01", 8085, $errno, $errstr, 30))
$output = '<div class="status">Server Status: <FONT COLOR="#ff1f1f">OFF</FONT></div>';
else
{
$output = '<div class="status">Server Status: <FONT COLOR="#3acc3a">ON</FONT></div>';
fclose($sock);
}
$output .= '<div class="status"> PG Online: <font color="#c9c9c9">';
$output .= $online_wid;
$output .= '</font></div>';
mysql_close($conn_widget);
sometimes "$online_wid" return nothing, some help ?
maybe cache problem ? :S
i have the same problem with similar widgets that should return data from an database..
thanks, i'm using vbulletin 4.1.10
i have added a new widget in my vbulletin cms. It's a "direct execution widget"
in it i have an Mysql query that return counts of some rows in my database..
but sometimes it returns nothing :S
i have tryed to run the query manually from "phpmyadmin" and the query itself works
this is the code of my widget:
require_once("mysql_vars.php");
$conn_widget = mysql_connect($host, $user, $pass);
mysql_select_db($characters, $conn_widget);
$result_wid = mysql_query("SELECT Count(Online) FROM `characters` WHERE `online` = 1", $conn_widget);
$row_wid = mysql_fetch_array($result_wid);
$online_wid = $row_wid["Count(Online)"];
if (!$sock = @fsockopen("127.0.01", 8085, $errno, $errstr, 30))
$output = '<div class="status">Server Status: <FONT COLOR="#ff1f1f">OFF</FONT></div>';
else
{
$output = '<div class="status">Server Status: <FONT COLOR="#3acc3a">ON</FONT></div>';
fclose($sock);
}
$output .= '<div class="status"> PG Online: <font color="#c9c9c9">';
$output .= $online_wid;
$output .= '</font></div>';
mysql_close($conn_widget);
sometimes "$online_wid" return nothing, some help ?
maybe cache problem ? :S
i have the same problem with similar widgets that should return data from an database..
thanks, i'm using vbulletin 4.1.10