Plugin / Database query doesn't work

leonor

Active Member
License Active
Hello, i have a custom plugin which not works anymore and i don't know why.


Code:
list($TMPL['online_servers'], $TMPL['total_online']) = mysql_fetch_row($DB->query("SELECT COUNT(*), SUM(sro_num_players) FROM `VL_stats` WHERE `sro_online` = '1'"));


$TMPL['sro_user_count'] = "We have " . $TMPL['num_members'] . " Servers in our list  atm, " . $TMPL['online_servers'] . " of which are online right now with a total of " . $TMPL['total_online'] . " Players.";
I tried to use skin_global.php, this was already working fine for me, but now i get nothing(query_data) in my template tag.

We have Servers in our list atm, of which are online right now with a total of Players.
If i try my query
Code:
SELECT COUNT(*), SUM(sro_num_players) FROM `VL_stats` WHERE `sro_online` = '1'
Response:



If i try to call the template tag {$sro_user_count} with the Seo plugin /child/main_welcome.html
Code:
<p class="lead text-center color-white seo_main_p">{$sro_user_count}</p>
and the i see just
Code:
We have Servers in our list atm, of which are online right now with a total of Players.
Any idea? is there any better hook, or did i something wrong?

Greetz,
leonor


EDIT:
If i use skin_global.php and put it to my wrapper.html i see this:

Still missing the data from query, and its not really a help i need my data in Seo Plugin :/
 
Last edited:

leonor

Active Member
License Active
@legendz no its not the same problem, this plugin just try to read data from database and write them to a template tag. But i think, did anything wrong or the way to do this changed since vl1.3 :(
 

Mark

Administrator
Staff member
@leonor if you have upgraded to 1.5 try this:

find:
PHP:
list($TMPL['online_servers'], $TMPL['total_online']) = mysql_fetch_row($DB->query("SELECT COUNT(*), SUM(sro_num_players) FROM `VL_stats` WHERE `sro_online` = '1'"));
change to:
PHP:
list($TMPL['online_servers'], $TMPL['total_online']) = mysqli_fetch_row($DB->query("SELECT COUNT(*), SUM(sro_num_players) FROM `VL_stats` WHERE `sro_online` = '1'"));
 

leonor

Active Member
License Active
Thanks, for your reply so short before christmas !

Yes i upgraded from 1.3 to 1.5 few days ago.

mysqli also doesn't work :( The strange thing i am using also $TMPL['num_members'] i didn't get them.

Code:
$TMPL['sro_user_count'] = "We have " . $TMPL['num_members'] . " Servers in our list  atm, " . $TMPL['online_servers'] . " of which are online right now with a total of " . $TMPL['total_online'] . " Players.";
I am using the right plugin hook, skin_global.php ?
 

Attachments

Mark

Administrator
Staff member
yup skin_global should be fine. I suspect that your issue is indeed related to mysqli.

Please run this command via SSH from your root directory (where settings_sql.php is found)

Code:
grep -R "mysql_" *
that will return a list of files that are using the old mysql_ functions, update each one with the mysqli version and see if that solves it for you.
 

leonor

Active Member
License Active
done, only the installer from some plugins are still with mysql_ but right now not important for me ;)

Unfortunately i noticed that i added the skin_global.php content to /seo/global_start.php ... was yesterday trying many things. And after deleting this the text has disappeared.

So right now didn't see anything from this plugin :(
 

Mark

Administrator
Staff member
I am not sure I understand, are you saying you seeing:

We have Servers in our list atm, of which are online right now with a total of Players.

or nothing at all?
 

leonor

Active Member
License Active
No right now i didn't see anything from this plugin.

PHP:
$TMPL['sro_user_count'] = "We have " . $TMPL['num_members'] . " Servers in our list  atm, " . $TMPL['online_servers'] . " of which are online right now with a total of " . $TMPL['total_online'] . " Players.";
We have Servers in our list atm, of which are online right now with a total of Players.
Saw only this line while i added my plugin code to the Seo Plugin ( /Seo/global_start.php) :p And after deleting it from there, i see nothing.

I uploaded the plugin folder, some post above maybe i forget something?

EDIT:

I just added {$sro_user_count} to my wrapper, and i see this. So there its working now


But still can't call the template tag in /Seo/child/main_welcome.html
 
Last edited:

Mark

Administrator
Staff member
ahh the SEO plugin template is probably not the correct place for this. You need to either make a new plugin, or add direct to wrapper.
 

leonor

Active Member
License Active
ah got it =)
i added my Template tag directly under "{$category_welcome}" and here we are its fixed !

Great, Thanks Mark !
 
Top