php – how to get a data then add up with datetime to make your own serial number-ThrowExceptions

Exception or error:

how to get the department name form drop down table and get also the date time and post it in database.

Sample output:

MIS1021971049,
AUX1022981048,
LIBRARY1024991050

Code:

if($_POST['btn_action'] == 'Add')
            {
                $query = "INSERT INTO monitoringv2 (monitoring_id, dept_id, category_id, asset_id, asset_refNo, asset_serialNo, asset_description, asset_quantity, asset_value, asset_supplier, assetDelivery_date, asset_remarks, monitoring_status, monitoring_created_date, monitoring_created_by)

                          VALUES (:monitoring_id, :dept_id, :category_id, :asset_id, :asset_refNo, :asset_serialNo, :asset_description, :asset_quantity, :asset_value, :asset_supplier, :assetDelivery_date, :asset_remarks, :monitoring_status, :monitoring_created_date, :monitoring_created_by)";
                          $timestamp= +7;
                    $statement = $connect->prepare($query);
                    $statement->execute(
                        array(
                            ':monitoring_id'         => $_POST["monitoring_id"],
                            ':dept_id'              => $_POST["dept_id"],
                            ':category_id'          => $_POST["category_id"],
                            ':asset_id'             => $_POST["asset_id"],
                            ':asset_refNo'          => $_POST["dept_name"+ ' ' +date("Y-m-d H:i:s")],
                            ':asset_serialNo'       => $_POST["asset_serialNo"],
                            ':asset_description'    => $_POST["asset_description"], 
                            ':asset_quantity'       => $_POST["asset_quantity"],
                            ':asset_value'          => $_POST["asset_value"],
                            ':asset_supplier'       => $_POST["asset_supplier"],
                            ':assetDelivery_date'   => $_POST["assetDelivery_date"],
                            ':asset_remarks'        => $_POST["asset_remarks"],
                            ':monitoring_status'        => 'active',
                            ':monitoring_created_date'  => date("Y-m-d H:i:s", strtotime('7 hour')),
                            ':monitoring_created_by'    => $_SESSION["user_name"]
                                        )
                    );
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *