我上传了2张图片进入数据库,想要通过id从数据库中检索...我不知道如何检索第一个ID。我可以使用以下方法检索第二个ID:
$lastid = mysql_insert_id();
//declare where the image is from
$before = $row['image']; //want to retrieve first id
$after = $row['image']; //this can be get by the $lastid
///更新了我的代码
我这样说:
$lastid = mysql_insert_id();
$pic = mysql_query("SELECT * FROM images WHERE id='$lastid'");
$row = mysql_fetch_assoc($pic);
//declare where the image is from
$before = $row['image'];
$after = $row['image'];
当我输出图像时,我得到了最后一个id