Core PHP

Get MySQL Property Values

This PHP program displays example code that demonstrates how to list all of the properties, types, and values of a MySQL connection.

MySqlGetPropertyValues.php

<?php
  $sServer = "127.0.0.1";
  $sUser = "root";
  $sPassword = "MyPassword";

  try {
    // Get all of the mysqli properties and their values.
    $qMySQLi = new mysqli($sServer, $sUser, $sPassword);
    foreach ($qMySQLi as $sKey => $sValue) {
      echo GetType($qMySQLi->$sKey)." qMySQLi->{$sKey} =<br />";
      echo "{$qMySQLi->{$sKey}} <br />";
    }
    // Close the connection
    $qMySQLi->close();
  } catch(Exception $eException) {
    echo "error: ".$eException->getCode()." ".$eException->getMessage();
  }
?>
 

Output

integer qMySQLi->affected_rows =
0 
string qMySQLi->client_info =
mysqlnd 5.0.11-dev - 20120503 - $Id: f373ea5dd5538761406a8022a4b8a374418b240e $ 
integer qMySQLi->client_version =
50011 
integer qMySQLi->connect_errno =
0 
NULL qMySQLi->connect_error =

integer qMySQLi->errno =
0 
string qMySQLi->error =

array qMySQLi->error_list =
Array 
integer qMySQLi->field_count =
0 
string qMySQLi->host_info =
127.0.0.1 via TCP/IP 
NULL qMySQLi->info =

integer qMySQLi->insert_id =
0 
string qMySQLi->server_info =
5.1.73-community 
integer qMySQLi->server_version =
50173 
string qMySQLi->stat =
Uptime: 265390 Threads: 1 Questions: 186 Slow queries: 0 Opens: 17 Flush tables: 1 Open tables:
 0 Queries per second avg: 0.0 
string qMySQLi->sqlstate =
00000 
integer qMySQLi->protocol_version =
10 
integer qMySQLi->thread_id =
156 
integer qMySQLi->warning_count =
0 
 
 

© 2007–2024 XoaX.net LLC. All rights reserved.