determine mysql version from php...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

determine mysql version from php...

Post by Burrito »

how can I do this?

I know I could run exec('mysql -h localhost -V'); but I want something a little more elegant....
SKDevelopment
Forum Newbie
Posts: 13
Joined: Thu Jan 26, 2006 10:42 am

Post by SKDevelopment »

I do not know how elegant it is, but I am doing it like this:

Code: Select all

$r = mysql_query("SELECT VERSION()") or die(mysql_error());
$a = mysql_fetch_row($r);
As a result you get something like $a[0] = "5.0.18-nt".

--
Best Regards,
Sergey Korolev
www.SKDevelopment.com
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

perfect, thank you.
Post Reply