Hey, how do i find the mysql version on the server?
I'm trying to make a report thinggy. so far i've been able to track down the php version with
phpversion();
any idea?
thanks...
-Nay
how to get mysql version
Moderator: General Moderators
haven't tested this but
Mark
Code: Select all
// returns a string with the current mySQL version connecting handled by $dbh.
$mysqlver = pos(mysql_fetch_row(mysql_query("SELECT VERSION()",$dbh)));thanks for the code, i tried it out as:
result:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in c:\appserv\www\sqlver.php on line 7
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\appserv\www\sqlver.php on line 7
Warning: pos(): Passed variable is not an array or object in c:\appserv\www\sqlver.php on line 7
any ideas?
-Nay
Code: Select all
<?
$connection = mysql_connect('localhost','Nay', 'xxxxxxxxxxx');
$dbh = mysql_select_db('news',$connection);
$mysqlver = pos(mysql_fetch_row(mysql_query("SELECT VERSION()",$dbh)));
echo $mysqlver;
?>Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in c:\appserv\www\sqlver.php on line 7
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\appserv\www\sqlver.php on line 7
Warning: pos(): Passed variable is not an array or object in c:\appserv\www\sqlver.php on line 7
any ideas?
-Nay
I did it like this...
Code: Select all
$connection = mysql_connect('host', 'user', 'pass');
$result = mysql_query("select version()");
$mysqlver = mysql_result($result,0);
echo $mysqlver;