如何匹配至少一个数字?

时间:2019-04-02 16:16:24

标签: php

我有一个如图所示的输入区域。由于价格至少是多少,我不知道如何为数据库匹配输入此价格。

<?php
$type = $_POST['type'];

$conn = mysqli_connect();   
$query = "select type, description, price from product where type = ?"; 
mysqli_stmt_bind_result($pStmt, $type_r, $description_r, $price_r);

1 个答案:

答案 0 :(得分:1)

将查询更改为(> =,因为您说价格至少是):

$query = "select type, description, price from product where type = ? and price >= ?";

并在$price之前实例化mysqli_stmt_bind_param($pStmt,'sd', $type, $price);

$price = $_POST["dollar"] . '.' . $_POST["cents"];