Click on the category image to view all the deals available | |||
Coming Soon ... | |||
/* * * version: 1.0 * modified: May 17, 2008 * * copyright: (c) 2008 ANGLER Technologies * notes: User class for REGISTRATION, LOGIN functions. * */ Class Crud extends sql_db { var $db_config; var $user_fields = array('user_id' => 'userid', 'user_name' => 'user_name'); function Crud() { $this->db_config = $GLOBALS[db_config]; $this->user_fields = $GLOBALS[user_table]; // call superclass constructor $this->sql_db($this->db_config); } function username_exists($table, $user_info, $where ) { $list_field_user = array('COUNT('.$user_info.') AS user_count'); $query_list = new query_select($table); $query_list->set_select($list_field_user); $query_list->set_where($where, '='); // Run the query. // PRINT '
' . $query_list->build_query() . '
'; $result = $this->sql_query($query_list->build_query()); $row = $this->sql_fetchrow($result); $this->sql_freeresult ($result); return $row['user_count']; } function login($table, $where) { // Build query object. $query_login = new query_select($table); $query_login->set_where($where, '='); // Run the query. //PRINT '' . $query_login->build_query() . '
'; // Query the database. $result_login = $this->sql_query($query_login->build_query()); $login = $this->sql_fetchrow($result_login); $this->sql_freeresult ($result_login); return $login; } // Function for Insert Record function insert_record($table, $user_info) { //print_r($user_info); $sql_insert = new query_insert($table); $sql_insert->set_insert($user_info); // Run the query. //PRINT '' . $sql_insert->build_query() . '
'; //exit; $result = $this->sql_query($sql_insert->build_query()); // Clear out object for next insert. $sql_insert->unset_insert(); // Successful insert. if ($this->sql_affectedrows () == 1) { return true; } else { return false; } $this->sql_freeresult ($result); } //Function for Update record function update_record($table, $user_info, $where, $type, $condition = '') { $sql_update = new query_update($table); $sql_update->set_update($user_info); $sql_update->set_where($where, $type); // Run the query. //PRINT '' . $sql_update->build_query() . '
'; //exit; $result = $this->sql_query($sql_update->build_query()); // Clear out object for next insert. $sql_update->unset_update(); // Successful update. if ($this->sql_affectedrows() == 1) { return true; } else { return false; } $this->sql_freeresult ($result); } //Function for Delete record function delete_record($table, $where, $type, $condition = '') { $sql_delete = new query_delete($table); $sql_delete->set_where($where, $type ); // Run the query. //PRINT '' . $sql_delete->build_query() . '
'; //exit; $result = $this->sql_query($sql_delete->build_query()); // Clear out object for next insert. $sql_delete->unset_where(); // Successful delete. if ($this->sql_affectedrows() == 1) { return true; } else { return false; } $this->sql_freeresult ($result); } } $mysql = new Crud(); ?>
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||