【发布时间】:2013-05-25 15:36:52
【问题描述】:
$sql_comp5 ="INSERT INTO `tiquets` (`Id_Tiquet`) VALUES (NULL); SELECT LAST_INSERT_ID()";
$result8 = mysql_query($sql_comp5);
$flag_control=0;
while ($row = mysql_fetch_assoc($result8, MYSQL_BOTH))
{
$flag_control=$flag_control+1;
$id_t[$flag_control]=$row['LAST_INSERT_ID()'];
}
for ($buc = 1; $buc <=$flag_control; $buc++)
{
$id_tiquet=$id_t[$buc];
}
我做对了吗?还是我错了?
非常感谢!!
【问题讨论】:
-
Please, don't use mysql_* functions in new code。它们不再维护and are officially deprecated。看到red box?改为了解prepared statements,并使用PDO 或MySQLi - this article 将帮助您决定哪个。如果你选择 PDO,here is a good tutorial.
标签: php mysql last-insert-id