Hi everyone, I'm having real difficulties :-(
the function below works just fine on a few calls to MySQL within the script but gets access denied when used in change_password() which I've also included at the end.
Any insight into this irregularity would be much appreciated :-)
function _db_connect() {
$this->link_id=@mysql_connect($this->host, $this->user,
$this->pass) or die("Could not connect to database");
if(!$this->link_id) {
return FALSE;
}
$db=@mysql_select_db($this->db) or die ("can't select db");
return TRUE;
}
and here is the function it fails in....
function change_password($email, $new_password) {
$new_password=md5($new_password); // encryption
$qry="UPDATE $this->table SET pass = '$new_password' ";
$qry.="WHERE email = '$email'";
if(!$this->_db_connect()) {
return FALSE;
}
if(!($result=mysql_query($qry, $this->link_id))) {
return FALSE;
} else {
if(mysql_affected_rows()==0) {
return FALSE;
} else {
$this->set_pass($new_password);
}
}
return TRUE;
}