Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>My Beauty Shop</title>
- <link rel="stylesheet" type="text/css" href="Styling.css" />
- </head>
- <body>
- <header><h1><img id="Logoimg" src="logo.jpg" height="200" /></h1></header> <!-- End of header -->
- <?php
- //Take the input
- $product = $_POST['product'];
- $month = $_POST['month'];
- $avgdsales = $_POST['avgDailysales'];
- // End of the input
- $leadtimedemand; // = Lead * avgdsales
- $reorderpoint; // = leadtimedemand + saftystock
- // Create new connection
- $user='root';
- $pass='';
- $db=''; //our db name
- $con= new mysqli('localhost',$user,$pass,$db) or die( "Could not connect to database " );
- if ($con->connect_error) {
- die("Connection failed: " . $con->connect_error);
- }
- // end of connection
- if ($product == "eyeliner") {
- $sql = "SELECT * FROM chanel";
- $result = mysql_query($sql) or die (mysql_error());
- $row = $result->fetch_assoc();
- $prodcutid = $row['ID'];
- $lead = $row["Lead"]; // lead time
- $safty_stock = $row["safty_stock"];
- $leadtimedemand = $lead * $avgdsales;
- $reorderpoint = $leadtimedemand + $safty_stock;
- $psql = "INSERT INTO eyeliner (productID, month, avgDsales, rOPoint)
- VALUES ($prodcutid, $month, $avgdsales, $reorderpoint)";
- print('<h3>after making somoe calculations we found that you have to order more eyeliners after '. $reorderpoint . ' since the lead time takes '. $lead . ' and your safty stock is ' . $safty_stock . 'and your average daily sales is ' . $avgdsales . '</h3>');
- }
- //end of eyeliner if
- if ($product == "eyeshadow") {
- $sql = "SELECT * FROM chanel";
- $result = mysql_query($sql) or die (mysql_error());
- $row = $result->fetch_assoc();
- $prodcutid = $row['ID'];
- $lead = $row["Lead"]; // lead time
- $safty_stock = $row["safty_stock"];
- $leadtimedemand = $lead * $avgdsales;
- $reorderpoint = $leadtimedemand + $safty_stock;
- $psql = "INSERT INTO eyeshadow (productID, month, avgDsales, rOPoint)
- VALUES ($prodcutid, $month, $avgdsales, $reorderpoint)";
- print('<h3>after making somoe calculations we found that you have to order more eyeshadows after '. $reorderpoint . ' since the lead time takes '. $lead . ' and your safty stock is ' . $safty_stock . 'and your average daily sales is ' . $avgdsales . '</h3>');
- }
- //end of eyeshadow if
- if ($product == "lipstick") {
- $sql = "SELECT * FROM chanel";
- $result = mysql_query($sql) or die (mysql_error());
- $row = $result->fetch_assoc();
- $prodcutid = $row['ID'];
- $lead = $row["Lead"]; // lead time
- $safty_stock = $row["safty_stock"];
- $leadtimedemand = $lead * $avgdsales;
- $reorderpoint = $leadtimedemand + $safty_stock;
- $psql = "INSERT INTO lipstick (productID, month, avgDsales, rOPoint)
- VALUES ($prodcutid, $month, $avgdsales, $reorderpoint)";
- print('<h3>after making somoe calculations we found that you have to order more lipsticks after '. $reorderpoint . ' since the lead time takes '. $lead . ' and your safty stock is ' . $safty_stock . 'and your average daily sales is ' . $avgdsales . '</h3>');
- }
- //end of lipstick if
- if ($product != "lipstick" && $product != "eyeliner" && $product != "eyeshadow") {
- print 'You didnt select any product please try again';
- }
- //end of if the user didnt select any product
- mysqli_close($con);
- ?>
- <div>
- <footer id="footer">
- <h6>COPYRIGHT © My Beauty Shop ALL RIGHTS RESERVED.</h6>
- </footer> <!-- End of Footer -->
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment