![]() |
PHP help
1 Attachment(s)
I converted some MySQL code from MySQL to MySQLi and got it working (sort of), just need a little help with the PHP now...
Original code: Code:
if ($_REQUEST['show'] == 'mysqlstats' || empty($_REQUEST['show'])) { Code:
function si_mysqlstats() { Code that is now working: Code:
if ($_REQUEST['show'] == 'mysqlistats' || empty($_REQUEST['show'])) { Code:
function si_mysqlistats() { Also, I would like the display to be: Uptime: 49602 Threads: 4 Questions: 850693 Slow queries: 16 Opens: 3099 Flush tables: 1 Open tables: 747 Queries per second avg: 17.150 Instead of the current: Uptime: 49602 Threads: 4 Questions: 850693 Slow queries: 16 Opens: 3099 Flush tables: 1 Open tables: 747 Queries per second avg: 17.150 Any help would be GREATLY appreciated! |
Why did you change the si_mysqlstats to print out the info? You probably just needed to copy the function and change mysql_stat to mysqli_stat.
|
Quote:
|
Oh, right, you needed the $link to call the function. So maybe this:
PHP Code:
And if you already have an open connection somewhere in the program, it would probably be better to change the function to take it as a parameter instead of opening another connection. |
Quote:
Many thanks! If I already had an open connection elsewhere, what would this code look like? |
Quote:
PHP Code:
PHP Code:
but after I posted that I realized that it looks like you're working on code from the admincp or modcp, so you might just be able to use global $db in place of $link, like PHP Code:
and you wouldn't have to change the other code. |
All times are GMT. The time now is 10:56 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|