|
/*============================= check for presence of bid from this seller=========================*/
$stmt="SELECT * FROM `bidding` WHERE `proj_id`='$id' AND `seller_id`='$row[id]'";
$res_bid=mysql_query($stmt);
$row_bid=mysql_fetch_array($res_bid);
$num=mysql_num_rows($res_bid);
if($num)
{
//update present bid data
$sql_update="UPDATE `bidding` SET `proj_id`='$id',`seller_id`='$row[id]',`seller_name`='$user',`bid_amount`='$amount',`ti meframe`='$days',`bid_time`='$bid_time',`bid_date` ='$date',`bid_details`='$details',`bid_notify`='$n otify',`bid_status`='0' WHERE `proj_id`='$id' AND `seller_id`='$row[id]'";
$res_update=mysql_query($sql_update)
or die("Could not update data".mysql_error());
$msg="Your bid has been successfully UPDATED";
header("location:confirmation.php?msg=$msg");
}
else
{
//insert first bid data
$qry="INSERT INTO `bidding` VALUES('','$id','$row[id]','$user','$amount','$days','$bid_time','$date','$ details','$notify','0')";
$result=mysql_query($qry)
or die("Could not insert data".mysql_error());
$msg="Your bid has been successfully recorded";
header("location:confirmation.php?msg=$msg");
}
------------------ Please suggest me how can i get the last inserted id in updation.
|