0

This question is similar to this one
However, my insert does not involve a form but a direct mysql query that looks like this

 $query2 = "insert into table(author,title,abstract) values(:author,:title,:abstract) ";
 $stm=$con->prepare($query2);

    $stm->bindValue(':author', $author, PDO::PARAM_STR);
    $stm->bindValue(':title', $title, PDO::PARAM_STR);
    $stm->bindValue(':abstract', $abstract, PDO::PARAM_STR);
    $stm->execute();
    echo "$author &nbsp $title &nbsp $abstract <br>"

In this scenario, 'id' is an auto increment. How can i get $id value when the insertion was not made via a form input?

2
Contributors
2
Replies
6
Views
1 Year
Discussion Span
Last Post by Amaina
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.