public static function getInstance() { if (is_null(self::$_instance)) { self::$_instance = new Mysql_Database(); } return self::$_instance; }
public static function connect($server_credentials = [], $new_link = true, $client_flags = 0) { extract($server_credentials); // Validate required elements if ('' === $server || null === $server) { throw new Exception(sprintf('Invalid $value: %s', serialize($server_credentials))); // TODO: spl error } self::$_link = mysql_connect($server, $username, $password, $new_link, $client_flags); }
public function call_dbFunction_without_param($dbFunctionName) { $this->database = Mysql_Database::getInstance(); $query = "call {$dbFunctionName}();"; $result = $this->database->query($query); //print_r($result); return $result; }
public function user_comments_export($output) { fputcsv($output, array('User Email', 'User Comment', 'Comment Type', 'Created On')); $database = Mysql_Database::getInstance(); //$date = date('m/d/Y h:i:s a', time()); $rows = mysql_query('SELECT user_email,user_comment,comment_type,created_on FROM feedback_usercomments'); // loop over the rows, outputting them while ($row = mysql_fetch_assoc($rows)) { if ($row['comment_type'] == 1) { $row['comment_type'] = "Positive"; } else { $row['comment_type'] = "Negative"; } // print_r($row); fputcsv($output, $row); } // }