php - Windows Azure MaxSizeInByte Statement -


i want current max size of db. have found statements checked out. works fine in vs2012 sql explorer. when im using php im geting no data.

this function:

function getload() { $conn = connect(); $string = 'databasepropertyex ( 'database' , 'maxsizeinbytes' )'; $stmt = $conn->query($string); return $stmt->fetchall(pdo::fetch_num); } 

the problem error in fetching $stmt. error is:

can not fetchall(11) 

this code print database edition , max size in gb:

<?php function get_database_properties($server, $database, $username, $password) {     try {         $conn = new pdo ("sqlsrv:server=tcp:{$server}.database.windows.net,1433; database={$database}", $username, $password);         $conn->setattribute(pdo::attr_errmode, pdo::errmode_exception);         $conn->setattribute(constant('pdo::sqlsrv_attr_direct_query'), true);         $query = "select convert(nvarchar(128), databasepropertyex ('{$database}', 'edition')) 'edition', " .                  "convert(decimal,databasepropertyex ('{$database}', 'maxsizeinbytes'))/1024/1024/1024 'maxsizeingb'";         $stmt = $conn->query($query);         $row = $stmt->fetch();         $conn = null;         return $row;     }     catch (exception $e) {         die(print_r($e));     } }  $db_properties = get_database_properties("yourserver", "yourdatabase", "youruser", "yourpassword"); print("edition={$db_properties['edition']} maxsizeingb={$db_properties['maxsizeingb']}\n"); ?> 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -