du_1993 2016-04-09 19:30
浏览 134
已采纳

mysqli_insert_id()总是返回NULL

mysqli_insert_id() always returning null.I cannot understand the reason for this

    $blocksql="insert into blockinfo values(NULL,'$user','$book','$blocktime','$quant1','$flag','$title')";

    mysqli_query($con,$blocksql);
    $id=mysqli_insert_id();
  • 写回答

2条回答 默认 最新

  • dqv2743 2016-04-09 19:34
    关注

    You're not passing a connection to mysqli_insert_id() of course it will always be null.

    $id = mysqli_insert_id($con);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?