I have a question about adding values into a table. Right now I am working on an application in which you can maintain the stock of, for example, a tool shop.
<?php
include 'dbconnect.php';
// Stock query
$sql = "SELECT * FROM product WHERE locationcode = 'loc1'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>".$row['locationcode']."</td>";
echo "<td>".$row['product_id']."</td>";
echo "<td>".$row['amount']."</td>";
}
}
else {
echo "0 results";
}
$conn->close();
The table that I made for the products available consists of the following columns:
- Product ID
- Product Type
- Brand
- Model
- Cost Price
- Selling Price
- Locationcode
- Amount
A lot of products from this tool shop are available on multiple locations (there are several physical stores located around the country).
Is it possible to add more than 1 value into a column? This is because the client should be able to filter on products and the corresponding locations (IE. A product can be available both in location 1 and location 2).
Thanks in advance!