Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How can i save data on my database?

Comments in 'Plugin Development' started by korado531m7, Dec 27, 2015.

  1. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    Hi. I'm trying to save a data to my website (text file as database).
    I wrote code, but it doesn't work.
    PHP:
    if($text == "a"){
        
    $testFile fopen("http://example.com/testfile.txt""w");
        
    $contents "testing";
            if (
    is_writable($testFile)) {
            if (!
    $fp fopen($testFile"a")) {
            
    $this->getServer()->getLogger()->info("Could not open");
            exit;
            }
        if (
    fwrite($fp$contents) === false) {
        
    $this->getServer()->getLogger()->info("Could not write");
        exit;
        }
    $this->getServer()->getLogger()->info("Done");
    fclose($fp);
        } else {
        
    $this->getServer()->getLogger()->info("Could not write 2");
        exit;
        }
    }
    Error below:
    Error: syntax error, unexpected 'public' (T_PUBLIC)
    File: /plugin/src/pluginname/Main
    Line: 2451
    Type: E_PARSE

    THIS CRASH WAS CAUSED BY A PLUGIN

    Code:

    Backtrace:
    #0 (): pocketmine\Server->crashDump(boolean)

    PocketMine-MP version: 1.6dev #1266 [Protocol 38; API 1.13.1]
    Git commit: 0000000000000000000000000000000000000000
    uname -a: Darwin Korado-MacBook-Air.local 15.2.0 Darwin Kernel Version 15.2.0: Fri Nov 13 19:56:56 PST 2015; root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64
    PHP Version: 5.6.4
    Zend version: 2.6.0
    OS : Darwin, mac

    How do i type code?
    Please tell me.
    Thank you for reading my thread, and answering.
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Write the code from the crash, not some random code from the plugin.
    HotFireyDeath likes this.
  3. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    Console :
    [00:23:51] [Server thread/INFO]: Could not write 2
    [00:23:51] [Server thread/EMERGENCY]: An unrecoverable error has occurred and the server has crashed. Creating a crash dump
    [00:23:51] [Server thread/EMERGENCY]: Please upload the "log path" file to the Crash Archive and submit the link to the Bug Reporting page. Give as much info as you can.

    I couldn't find the line from the console
  4. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    it doesn't mean that.
    HotFireyDeath likes this.
  5. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    LINE 2451
    show us the FULL Code or maybe line 2400 to 2451
    applqpak and CraftYourBukkit like this.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Wait, why are you even using exit()? If your plugin has problems, just self-disable, don't stop the whole server. Also, exit will not stop other threads, and the server will hang.

    And which line is line 2451?

Share This Page

Advertisement