I'm completely new on PHP & MySQL. I manage to add 1 value from table "products" but failed to add another one.
There is two row within products table like below:
products:
- product_name
- product_price
My code:
$sql = "INSERT INTO products (product_name, user_id) VALUES (?, ?)";
$statement = $conn->prepare($sql);
$statement->bind_param('si', $_POST['product_name'], $_SESSION['user_id']);
if ($statement->execute()) {
redirect_to("/create.php?created=true");
} else {
echo "Error: " . $conn->error;
}
What is the correct way to add another row which is product_price ?