gpt4 book ai didi

php mysql 查询

转载 作者:太空宇宙 更新时间:2023-11-03 11:17:16 26 4
gpt4 key购买 nike

我试着打印这个:

$idg = array_filter(explode(",", $IDGruppo)); //url string
$idv = array_filter(explode(",", $IDVarianti)); // url string

$sql = "SELECT * FROM ccc WHERE ";

foreach($idg as $v)
{

foreach($idv as $c)
{

$sql .= "IDG = '". $v ."' AND IDF = '".$c."' AND Cancellato = '0' ";

if ( count($idv) != $i )
$sql .= "OR ";
$i++;
}

if ( count($idg) != $j )
$sql .= "OR ";
$j++;
}

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDGruppo = '34' AND IDFamiglia = '130' AND Cancellato = '0' OR IDGruppo = '34' A' at line 1

查询:

SELECT * FROM catalogo_prodotti WHERE IDGruppo = '29' AND IDFamiglia = '130' AND Cancellato = '0' OR IDGruppo = '29' AND IDFamiglia = '142' AND Cancellato = '0' IDGruppo = '34' AND IDFamiglia = '130' AND Cancellato = '0' OR IDGruppo = '34' AND IDFamiglia = '142' AND Cancellato = '0' OR

最佳答案

你在末尾有额外的OR

关于php mysql 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4224067/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com