-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathstock.php
More file actions
32 lines (25 loc) · 725 Bytes
/
stock.php
File metadata and controls
32 lines (25 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
$servername = "127.0.0.1";
$username = "root";
$password = "";
$dbname = "dbms";
$stockn=$_POST['stockn'];
$quantity=$_POST['quantity'];
$price=$_POST['price'];
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO stock(name,quantityinstock,price) VALUES('$stockn', $quantity, $price)";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
<div>
<font size="2">Add Stock or New Buyer details <a href="buyerstock.html">click here</a></font>
</div>