user = $user; $this->pass = $pass; } function Create($db) { if(!$this->user) { $this->user = "nancysp_admin"; } if(!$this->pass) { $this->pass = "sooners"; } $this->db = $db; $this->id = @mysql_connect($this->host, $this->user, $this->pass) or MySQL_ErrorMsg("Unable to connect to MySQL server: $this->host : '$SERVER_NAME'"); $this->selectdb($db); } function SelectDB($db) { @mysql_select_db($db, $this->id) or MySQL_ErrorMsg("Unable to select database: $db"); } /** * Use this function if the query will return multiple rows. Use a while * loop to loop through those rows. [ while(mysql_fetch_array($result)) ] */ function Query($query) { $this->result = @mysql_query($query, $this->id) or MySQL_ErrorMsg("Unable to perform query: $query"); $this->rows = @mysql_num_rows($this->result); $this->a_rows = @mysql_affected_rows($this->id); return($this->result); } /** * Use this function if the query will only return a * single data element. */ function QueryItem($query) { $this->result = @mysql_query($query, $this->id) or MySQL_ErrorMsg("Unable to perform query: $query"); $this->rows = @mysql_num_rows($this->result); $this->a_rows = @mysql_affected_rows($this->id); $this->data = @mysql_fetch_array($this->result); return($this->data[0]); } /** * This function is useful if the query will only return a * single row. */ function QueryRow($query) { $this->result = @mysql_query($query, $this->id) or MySQL_ErrorMsg("Unable to perform query: $query"); $this->rows = @mysql_num_rows($this->result); $this->a_rows = @mysql_affected_rows($this->id); $this->data = @mysql_fetch_array($this->result); return($this->data); } /** * These are nothing special, you must still write a complete SQL statement. * I think they do improve code readability though, and provide error checking. */ function Insert($query) { $this->result = @mysql_query($query, $this->id) or MySQL_ErrorMsg("Unable to perform insert: $query"); $this->a_rows = @mysql_affected_rows($this->id); } function Update($query) { $this->result = @mysql_query($query, $this->id) or MySQL_ErrorMsg("Unable to perform update: $query"); $this->a_rows = @mysql_affected_rows($this->id); } function Del($query) { $this->result = @mysql_query($query, $this->id) or MySQL_ErrorMsg("Unable to perform Delete: $query"); $this->a_rows = @mysql_affected_rows($this->id); } /** * Given a mysql result object (from Query), returns an associative * array from the result. */ function getArray($result_object) { $ret_data = array(); while( $row = mysql_fetch_array( $result_object ) ) { $ret_data[] = $row; } return $ret_data; } } /** * Displays a MySQL error message in a readable format (kills the page * generation so the error can be viewed) */ function MySQL_ErrorMsg($msg) { // Close out a bunch of HTML constructs which might prevent // the HTML page from displaying the error text. echo("\n"); echo("\n"); // Display the error message $text = "

Error: $msg :"; $text .= mysql_error(); $text .= "\n"; die($text); } ?>
Fatal error: Class 'MySQL_class' not found in /home/nancysp/public_html/classes/sqlConnection.php on line 5