My problem is that I have two functions and I try to call one in the other but I get the error it is undefined. Here is my code:
class LoggedUser extends User {
public function rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
}
public function usunGalerie($galeria,$log,$folder){
require_once('db_connect.inc');
$query = "DELETE FROM galery WHERE Nazwa='$galeria' AND Autor='$log';";
$result = @mysql_query($query);
if(!$result = mysql_query($query))
{
echo '<code>$query</code> → '.mysql_error().' ('.mysql_errno().')';
}
$query = "DELETE FROM zdjecie WHERE Galeria='$galeria' AND Autor='$log';";
$result2 = @mysql_query($query);
if ($result && $result2) {
echo 'Usunięto galerię '.$galeria;
$this->rrmdir($folder);
} else {
echo 'Wystąpił błąd.';
}
}
}
then I get: Call to undefined function rrmdir() I tried to call it without $this-> but it's the same.
Please can anyone help me?
rrmdir()is a method in your class, so use$this->rrmdir()