我需要传递两个参数名称为" supplier"和"股票名称"在下面的sql语句中。
<?php
include_once("init.php");
$line = $db->queryUniqueObject("SELECT * FROM stock_details WHERE stock_name ='" . $_POST['stock_name'] . "'");
$cost = $line->company_price;
$sell = $line->selling_price;
$stock_id = $line->stock_id;
$line = $db->queryUniqueObject("***SELECT * FROM customer_stock WHERE name ='" . $_POST['stock_name'] . "'"***);
$stock = $line->quantity;
if ($line != NULL) {
$arr = array("cost" => "$cost", "sell" => "$sell", "stock" => "$stock", "guid" => $stock_id);
echo json_encode($arr);
} else {
$arr1 = array("no" => "no");
echo json_encode($arr1);
}
?>
谢谢
答案 0 :(得分:0)
我认为通过&#34;参数&#34;你的意思是&#34;条件&#34;。
"SELECT * FROM customer_stock WHERE name ='" . $_POST['stock_name'] . "' AND supplier = '" . $_POST['supplier'] . "'"