user188962
user188962

Reputation:

Possible to 'Show MySQL Variables' with PHP code onto the browser?

Is this possible:

 mysql_query("SHOW VARIABLES LIKE 'query%'");

in php?

If so how can I display the variables onto the browser?

If it is not possible, which mysql command tool is easiest and free to download?

Thanks

Upvotes: 4

Views: 4717

Answers (2)

MSpreij
MSpreij

Reputation: 1152

Yes, it's possible, I just tried SHOW VARIABLES LIKE 'max%'

You can show them in the browser like you would show the results from any other query..

$res = mysql_query("SHOW VARIABLES LIKE 'max%'");
while ($row = mysql_fetch_assoc($res)) {
  echo $row['Variable_name'].':'.$row['Value']."<br>\n";
}

Upvotes: 5

Davide Gualano
Davide Gualano

Reputation: 13003

I think you can do something like

$result = mysql_query("SHOW VARIABLES WHERE VARIABLE_NAME LIKE 'query%'");
while ($rs = mysql_fetch_assoc($result) {
   foreach($rs as $key => $value) {
        print "{$key}: {$value}<br />";
    }
}

Upvotes: 0

Related Questions