1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Data isn't inserting (MYSQL)

Discussion in 'Development' started by iCirgio, Dec 27, 2019.

  1. iCirgio

    iCirgio Slime

    Messages:
    92
    GitHub:
    lolnova
    PHP:
            $name $this->getName();
            
    $rank "Player";
            
    $start 200;
            
    $i 0;
            
    $data $db->prepare("INSERT INTO playerdata(username, rank, money, kills, deaths, pvpenabled, pvptime) VALUES (?, ?, ?, ?, ?, ?, ?)");
            
    $data->bind_param("ssiiiii"$name$rank$start$i$i$i$i);
            
    $data->execute();
            
    $data->close();
    I'm trying to insert data into my table but it isn't inserting.
    1. There is no error when the server calls the code it just doesn't insert data in the database
    2. Yes, the database is connected to the server (Tested the connection before)
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    var_dump($data->error); will show you the error.
    Alternatively, you can configure mysqli_report() to throw errors.
    PHP:
    mysqli_report(MYSQLI_REPORT_ALL & ~MYSQLI_REPORT_INDEX); // call right before creating mysqli instance
    $data = new mysqli(...);
     
  3. iCirgio

    iCirgio Slime

    Messages:
    92
    GitHub:
    lolnova
    I did that and this is what i'm getting
    Code:
    string(0) ""

    Actually it did update into mysql but for some reason (playername).dat isnt saving[/CODE]
     
  4. iCirgio

    iCirgio Slime

    Messages:
    92
    GitHub:
    lolnova
    nvm. Solved, thanks muq
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.