Auto increment get Last id in mysql

Auto increment get Last id in mysql database for map two tables

<?php
$sql="INSERT INTO emailcampaign(campaignid,    campaignnm,campaignsubject,campaignbody,userid,createdate,status)VALUES
                ('','$cname','$csubject','$cbody','$sid','$dt','0')";
            $res=mysql_query($sql);
             $aid=mysql_insert_id();// generate automatic first get auotomatic increments id
             printf("Last inserted record has id %d\n", mysql_insert_id());//demo
?>

Share on Google Plus

About quora Questions & Answers A-Z

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment