Jump to content

php to mysql, INSERT problem


Karaethon

Recommended Posts

I'm being given an error by mysql, "Warning: mysqli_connect() expects parameter 1 to be string, object given in /storage/...", the relevant lines are

$code = $this->GenerateCode($num);
$enCoded = password_hash($code, PASSWORD_BCRYPT);
$query = "INSERT INTO `vaults` " .
"(`Alive`, `Contents`, `Code`, `digits`, `Winning_Player_ID`, `Won_Date`, `debug`)" .
"VALUES " .
"(CONV('1', 2, 10) + 0, '0', '{$enCoded}', '$num', NULL, NULL, '{$code}')";

Followed by the mysqli_connect($this->db, $query). 

Link to comment
Share on other sites

7 minutes ago, Karaethon said:

I'm guessing it doesn't like "$this->db"?

there's no guessing in programming. it is an exact science. you must know what the input parameters are, what the statement does, and what value is returned. mysqli_connect is NOT used to execute a query.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.