jeudi 31 mai 2018

php web application not responding

so i have a problem with my php application. i have an inventory management system and i hosted this on my shared hosting environment, but at times the application crashes

Error message thats the error message i get from chrome.

how i get this error is when i add data to the database, but it doesn't happen always. so i really cant find out the error. or is it the way i have written the code. i am a software engineering student so i am still learning. any advice would be great

Thank you in advance.

And this is the code that i use to enter the stock to database.

                   if(isset($_POST['Submit'])){
                   $ProductName = $_POST['ProductName'];
                   $Quantity = $_POST['Quantity'];

                    $datetime = date('D Y-m-d h:i:s A');

                    $sql = "select * from products WHERE PRODUCT_DESC = '".$ProductName."'";
                    $data = mysqli_query($dbCon,$sql);

                      while($record = mysqli_fetch_array($data)){

                        $sqlGetStock = "select PRODUCT_STOCK from stock WHERE PRODUCT_DESC = '".$record['PRODUCT_DESC']."'";
                        $dataGetStock = mysqli_query($dbCon,$sqlGetStock);

                        while($recordGetStock = mysqli_fetch_array($dataGetStock)){
                          $addStock = $Quantity + $recordGetStock['PRODUCT_STOCK'];

                          $sqladdStock = "UPDATE stock SET PRODUCT_STOCK='".$addStock."' WHERE PRODUCT_DESC = '".$ProductName."'";
                          $dbCon->query($sqladdStock);



                          }

                        }


                   header('location: ../add-stock.php');


                      }




Aucun commentaire:

Enregistrer un commentaire