$table->show(); } catch (\Exception $e) { echo $e->getMessage(); } // */ // // example 2 using mysqli // //* try { $table = new \Cli\Table(); $db = new \mysqli('localhost', 'H675X16em4', 'XOc1pu3AcAnINA2eKEY4ruRO8i8iXI', 'test'); if ($db->connect_errno) { throw new \Exception("Failed to connect to MySQL: (" . $db->connect_errno . ") " . $db->connect_error); } if (!($stmt = $db->prepare("SELECT * FROM `table`"))) { throw new \Exception("Prepare failed: (" . $db->errno . ") " . $db->error); } if (!$stmt->execute()) { throw new \Exception("Execute failed: (" . $stmt->errno . ") " . $stmt->error); } $table->importFromMysqli($stmt); $table->show(); $stmt->close(); } catch (\Exception $e) { echo $e->getMessage(); if (isset($db)) { $stmt->close(); } } // */