<?php if (!defined('_LIB')) { define('_LIB', realpath(dirname(__FILE__) . '/../') . '/src/_Libs/'); } require_once _LIB . '/_Db.php'; use _\_Db; $host = 'localhost'; $username = '******'; $password = '******'; $dbName = 'foo'; $db = new _Db($host, $username, $password, $dbName); $id = 1; $escapedId = $db->escape($id); $sql = "SELECT * FROM bars WHERE id='{$escapedId}'"; $db->query($sql); if ($row = $db->getRow()) { $thing = $row['col_name']; } echo $thing;
private function clearDb() { $db = new _Db(); $sql = "TRUNCATE TABLE _testtable"; $result = $db->query($sql); $this->assertTrue($result); }