note 102934 added to function.ini-get

From: Date: Tue, 15 Mar 2011 15:32:57 +0000
Subject: note 102934 added to function.ini-get
Groups: php.notes 
Request: Send a blank email to php-notes+get-177902@lists.php.net to get a copy of this message
Here is a php function that will return MySQL configuration variables: function GET_MYSQL_VARS($name=NULL,$single=false) { // Purpose: Return array of mysql variables and their associated values, or false if the variable is not found. // Usage: GET_MYSQL_VARS(); GET_MYSQL_VARS("max_%"); GET_MYSQL_VARS("datadir",true); // Notes: If a single variable is requested and $single = true, it's value (instead of an array) will be returned // Requirements: a current open database connection to MySQL // ------------------------------------------- // Copyright (c) Peter Kionga-Kamau http://www.DeveloperER.com - Free for unrestricted use under two conditions: // 1. NOT FOR SALE! You may USE this function for any purpose (including using it in products that you sell), however: // YOU MAY NOT SELL THIS FUNCTION, even if it is bundled with other functions. // 2. This comment and copyright notice must not be changed at any time. // ------------------------------------------- $o = array(); $r = mysql_query("SHOW VARIABLES".($name?" LIKE '".mysql_real_escape_string($name)."'":"")); while($t = mysql_fetch_array($r,MYSQL_NUM))$o[$t[0]]=$t[1]; return mysql_num_rows($r)>0? ($single&&mysql_num_rows($r)==1? $o[$name]:$o):false; } ---- Server IP: 69.147.83.197 Probable Submitter: 71.63.5.242 ---- Manual Page -- http://www.php.net/manual/en/function.ini-get.php Edit -- https://master.php.net/note/edit/102934 Del: integrated -- https://master.php.net/note/delete/102934/integrated Del: useless -- https://master.php.net/note/delete/102934/useless Del: bad code -- https://master.php.net/note/delete/102934/bad+code Del: spam -- https://master.php.net/note/delete/102934/spam Del: non-english -- https://master.php.net/note/delete/102934/non-english Del: in docs -- https://master.php.net/note/delete/102934/in+docs Del: other reasons-- https://master.php.net/note/delete/102934 Reject -- https://master.php.net/note/reject/102934 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#177902) next »