public function get_by_id($id) { $user = null; //DATABASE CONNECTION $this->db->connect(); //SELECT BY ID $sql = "SELECT * FROM user WHERE user_id=?"; //PREPARE $stmt = $this->db->initialize($sql); //BIND $stmt->bind_param("i", $id); //EXECUTE $stmt->execute(); //BIND RESULT $stmt->bind_result($user_id, $user_name, $first_name, $last_name, $contact_number, $user_type, $user_status); while ($stmt->fetch()) { //instantiate object $user = new User(); $user->set_user_id($user_id); $user->set_user_name($user_name); $user->set_first_name($first_name); $user->set_last_name($last_name); $user->set_contact_number($contact_number); $user->set_user_type($user_type); $user->set_user_status($user_status); } $this->db->close(); return $user; }
public function get_all() { //ARRAY OBJECT HARU PASS GARNA $user_list = array(); //DATABASE CONNECTION $this->db->connect(); //SELECT ALL QUERY $sql = "SELECT user_id,user_name,first_name,last_name,contact_number,user_type,user_status,name,doe,img,address,service,objective FROM user INNER JOIN welfare ON user_id = u_id"; //fetchquery $result = $this->db->fetchquery($sql); //STORE IN OBJECT AND SEND TO VIEW while ($row = $result->fetch_assoc()) { $user = new User(); $user->set_user_id($row['user_id']); $user->set_user_name($row['user_name']); $user->set_first_name($row['first_name']); $user->set_last_name($row['last_name']); $user->set_contact_number($row['contact_number']); $user->set_user_type($row['user_type']); $user->set_user_status($row['user_status']); $user->set_welf_name($row['name']); $user->set_welf_doe($row['doe']); $user->set_welf_img($row['img']); $user->set_welf_address($row['address']); $user->set_welf_objective($row['objective']); $user->set_welf_service($row['service']); array_push($user_list, $user); } $this->db->close(); return $user_list; }
public function get_all() { //ARRAY OBJECT HARU PASS GARNA $user_list = array(); //DATABASE CONNECTION $this->db->connect(); //SELECT ALL QUERY $sql = "SELECT user_id,user_name,first_name,last_name,contact_number,user_type,user_status,gen_id,age FROM user INNER JOIN generaluser ON user_id = u_id"; //fetchquery $result = $this->db->fetchquery($sql); //STORE IN OBJECT AND SEND TO VIEW while ($row = $result->fetch_assoc()) { $user = new User(); $user->set_user_id($row['user_id']); $user->set_user_name($row['user_name']); $user->set_first_name($row['first_name']); $user->set_last_name($row['last_name']); $user->set_contact_number($row['contact_number']); $user->set_user_type($row['user_type']); $user->set_user_status($row['user_status']); array_push($user_list, $user); } $this->db->close(); return $user_list; }
// * the Free Software Foundation, either version 3 of the License, or * // * (at your option) any later version. * // * * // * This program is distributed in the hope that it will be useful, * // * but WITHOUT ANY WARRANTY; without even the implied warranty of * // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * // * GNU General Public License for more details. * // * * // * You should have received a copy of the GNU General Public License * // * along with this program. If not, see <http://www.gnu.org/licenses/>. * // * * // ************************************************************************* include_once 'inc/core.php'; $userid = $session->user_id(); $user = new User(); $user->set_user_id($session->user_id()); include_once 'themes/' . sz_config('theme') . '/header.php'; error_reporting(-1); //END SESSION CHECK $passw_changed = false; $showindex = true; if (isset($_GET['user']) && $_GET['user'] == 'save' && $userid != 0) { if ($_POST['id'] != '' && $_POST['username'] != '' && $_POST['fullnames'] != '' && $_POST['phone'] != '' && $_POST['email'] != '') { $savedetails = true; //UpdateUser $userdata = array(); $userdata['id'] = clean_POST($_POST['id']); $userdata['username'] = clean_POST($_POST['username']); $userdata['group'] = clean_POST($_POST['group']); $userdata['account_active'] = clean_POST($_POST['account_active']); $userdata['fullnames'] = clean_POST($_POST['fullnames']);