T_paamayim_nekudotayim

I have this T_PAAMAYIM_NEKUDOTAYIM error before but in a different scenario. I can’t resolve how to fix this after searching google.

I tried self::$deleteFile and $this->deleteFile in both cases, but it didn’t do anything, can anyone give me advice please. The Query returns properly, and the name outputs correctly, It’s that unset thing giving me trouble.

class File
{
// just showing the problem here

    public function Remove($uniqueID)
    {
        /** Get the File name */
        $this->DB->Query("
            SELECT        file
            FROM        files
            WHERE        `id` = $uniqueID
            LIMIT        1
            ");
            
        $deleteFile = $this->DB->Get('file');
        
        /** Delete the File */
        unset(UPLOAD . $deleteFile);  // This is the line causing the error
    }
}

Why don’t you post error message itself?

Sure:
Parse error
: parse error, expecting `T_PAAMAYIM_NEKUDOTAYIM’ in C:\Workspace\janitor\system\framework\utilities\File.php on line 88

Which is line 88?

Edit: Ah, saw your comment… Normally this error results from you using :: where you shouldn’t. unset() should be used on a variable, but you have a variable being concatenated with a constant in there, which is probably causing problems. What is the 'UPLOAD . ’ in there for?

I did this and it works, UNSET doesn’t like that constant,
which is the location to the directory files are stored.


        $deleteFile = $this->DB->Get('file');
        
        $deletePath = UPLOAD . $deleteFile;
        /** Delete the File */
        unset($deletePath);    



That’s strange to me :\ Thanks :slight_smile:

unset just unsets a variable. If you want to remove the file from the filesystem, the function you want is unlink()

Oh, good call storm