我正在通过Ajax将一些数据从JS传递到PHP,并且正在使用该数据通过查询从我的数据库中检索信息,但出现错误:调用未定义函数where()on -where('Commande_nadine.DATE_DOCUMENT_CMD_ACHAT_FRS',“>”,$首次亮相) ->哪里('Commande_nadine.DATE_DOCUMENT_CMD_ACHAT_FRS',“ <”,$ Fin)
这是我的代码:
public function Calculer( Request $request )
{
if(isset($request))
{
$marque = $request->get('marque');
$modele = $request->get('modele');
$finition = $request->get('finition');
$Debut = $request->get('Debut');
$Fin =$request ->get('Fin');
$Debut=strtotime($Debut);
$Fin=strtotime($Fin);
$TotalAproduire = 100;
$Commande = DB::connection('sqlsrv2')->table('Commande_nadine')
->join('finition','Commande_nadine.CodeFinition','=','finition.CodeFinition')
->where('finition.CodeFinition',"=",$finition)
->where('finition.CodeModele','=',$modele)
-where('Commande_nadine.DATE_DOCUMENT_CMD_ACHAT_FRS',">",$Debut)
->where('Commande_nadine.DATE_DOCUMENT_CMD_ACHAT_FRS',"<",$Fin)
->where('finition.CodeMarque','=',$marque)
->count('Commande_nadine.RECID_NADIN');
$PourcentageCommandee=($Commande/$TotalAproduire)*1000;
return $PourcentageCommandee ;
}
else
{
echo "failed";
}
}
您能帮助解决这个问题吗?
答案 0 :(得分:1)
在这一行:
-where('Commande_nadine.DATE_DOCUMENT_CMD_ACHAT_FRS',">",$Debut)
您在>
之前缺少where
:
->where('Commande_nadine.DATE_DOCUMENT_CMD_ACHAT_FRS',">",$Debut)