国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

自帶的mysql為什么插入成功,但是返回的0?

a1747699213

$insertId = self::$conn->insert($this->table)->cols($data)->query();

echo $insertId;

數(shù)據(jù)庫(kù)里面已經(jīng)有數(shù)據(jù)了,但是這個(gè)始終是返回0

3804 1 0
1個(gè)回答

a1747699213

解決了。是因?yàn)槲冶淼闹麈I是創(chuàng)建的全球ID,不是自增ID。

建議如下解決:
在官方的文件\workerman\mysql\src\Connection.php第1838行,源代碼如下。
if ($this->sQuery->rowCount() > 0) {
return $this->lastInsertId();
}

修改為:
if ($this->sQuery->rowCount() > 0) {
if( $this->lastInsertId() == 0 )
{
return true;
}
return $this->lastInsertId();
}

  • 暫無(wú)評(píng)論
年代過(guò)于久遠(yuǎn),無(wú)法發(fā)表回答
??