我想将图像与名字,姓氏相关联...如何检索最后一行并将其插入到另一个表中?我试过$image = $mysqli->insert_id;然后绑定,但不起作用。有人可以帮我吗?
$image = $mysqli->insert_id;//this should come from table2
$stmt = $mysqli->prepare("
insert into table1 (username, firstname, lastname, image)
select ?,?,?,image from table2 t2 where username = ? and t2.id = ?
");
$stmt->bind_param('sssss', $username, $fname, $lname, $username, $image);
$stmt->execute();
慕森王