<?php
class myController{
private $host="localhost", $user="root", $pass="", $db="animeshop";
public $con, $db_select;
public $user_name, $user_pass, $user_fname, $user_lname, $user_mname, $user_add, $queried;
public function connect(){
$this->con = mysql_connect($this->host, $this->user, $this->pass);
$this->db_select = mysql_select_db($this->db, $this->con);
}
public function query($result){
return mysql_query($result, $this->con);
}
public function destruct(){
return mysql_close($this->con);
}
}
class member extends myController{
public $user_name, $user_pass, $user_fname, $user_lname, $user_mname, $user_add, $queried;
public $user_log, $pass_log, $result;
public function __construct($fname, $lname, $mname, $add, $password, $username){
$this->user_name = $username;
$this->user_pass = $password;
$this->user_fname = $fname;
$this->user_lname = $lname;
$this->user_mname = $mname;
$this->user_add = $add;
$this->queried = "INSERT INTO customer_account(customer_name, customer_last_name, customer_mid_name, customer_address, username, password) values('$this->user_fname', '$this->user_lname', '$this->user_mname', '$this->user_add', '$this->user_name', '$this->user_pass')";
}
public function get_query(){
$this->query($this->queried);
}
public function set_login($acc_user, $acc_pass){
$this->user_log = $acc_user;
$this->pass_log = $acc_pass;
$this->select_query = "SELECT * FROM customer_account where username = '$this->user_log' && password = '$this->pass_log'";
}
public function get_login(){
$this->result = $this->query($this->select_query);
}
}
?>
my problem is nag expect 2 ug parameters ang mysql_query nako which is ang 2nd parameter jud nga naka declare naman cya daan nya public pajud para ma reuse sa sakong member nga class...pero ako gi check ok man tanan. if akong in apil ang $this->connect() before sa $this->query() inside sa kong member class working cya, pero di man cguro advisable nga mga cge kog establish ug connection sakong db everytime nga mo query ko kay naka establish nman cya sakong myController.
can anyone help me with this problem?
i'm still practicing OOP para pangandam sa php frameworks...still preferred hardcode gihapon