sách gpt4 ai đã đi

php - mysql_insert_id 似乎从来没有工作过

In lại 作者:行者123 更新时间:2023-11-30 23:57:46 25 4
mua khóa gpt4 Nike

我有以下代码:

$sql = "INSERT INTO table VALUES ('', ...)";
$result = mysql_query($sql, $link) or die(mysql_error());
$id = mysql_insert_id($result) or die('oops'); //mysql_error() instead of oops produces the same result
echo $id . "\nDone";

这个插入发生的表有一个自动增量字段,但是这个输出的所有内容是:

Done

我做错了什么吗?

1 Câu trả lời

您不需要将 $result 传递给 mysql_insert_id,您应该传递 $link 变量。

关于php - mysql_insert_id 似乎从来没有工作过,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/435886/

25 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com