0

I created the following table inside a DB

$sql = "CREATE TABLE tac_flightsize
(
    id int NOT NULL AUTO_INCREMENT,
    PRIMARY KEY (id),

    gameid int NOT NULL,
    shipid int,
    flightsize int
 )";

I check for a DB write like this:

if (!$ship->superheavy){
   debug::log("db flight: " + $ship->flightSize);
   self::$dbManager->submitFlightSize($id, $gamedata->id, $ship->id, $ship->flightSize);
}

The debug::log entry shows 12 as the $ship->flightSize so the value is correct.

Here is the actual submitFlightSize function:

public function submitFlightSize($shipid, $gameid, $flightSize){
        try{
            $sql = "INSERT INTO `B5CGM`.`tac_flightsize` VALUES(null, $gameid, $shipid, $flightSize)";
            $id = $this->insert($sql);
            Debug::log($sql);

        }catch(Exception $e) {
            $this->endTransaction(true);
            throw $e;
        }
}

The Debug:::log from this function shows the follow SQL entry

INSERT INTO `B5CGM`.`tac_flightsize` VALUES(null, 2535, 16238, 1) 

Now, the last parameter is 1, when it should be 12 and was a second ago according to the earlier debug.

Can anyone explain to me what i might be doing wrong ?

1 Answer 1

4

here you send 4 params

self::$dbManager->submitFlightSize($id, $gamedata->id, $ship->id, $ship->flightSize);

but function accepts only 3

public function submitFlightSize($shipid, $gameid, $flightSize)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.