Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class MySQL {
- private $ref;
- public function __construct(&$ref) {
- $this->ref = &$ref;
- }
- public function escape($string) {
- return mysql_real_escape_string($string, $this->ref);
- }
- public function getError() {
- return mysql_error($this->ref);
- }
- public function selectDB($db) {
- return (mysql_select_db($db, $this->ref))?true:false;
- }
- public function query($query) {
- return @mysql_query($query, $this->ref)or print("Erro: ".mysql_error()."\n");
- }
- public function getRows($query) {
- return mysql_num_rows($this->query($query));
- }
- public function returnArray($query) {
- $result = (is_resource($query))?$query:mysql_query($query);
- $arr = array();
- while($row = mysql_fetch_assoc($result)) $arr[] = $row;
- return $arr;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement