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?

Thanks @cereal. It works like Magic

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.