女性、男性、子供の自転車の種類をフィルタリングしようとしています。一連の数字を選択した種類の自転車に並べ替える関数を作成しました。
function: bicycle($stringnumbers, $sortbicycle)
脚本:
function bicycle($stringnumbers, $sortbicycle){
$bicycle = explode(',', $bicyclenumbers);
foreach($bicycle as $bicycle1)
{
$sql2 = "SELECT * FROM `bicycle` WHERE `bicyclenumber` LIKE '".$bicycle1."' LIMIT 0, 30 ";
$number = mysql_query($sql2)or die(mysql_error());
while ($bicycleinfo = mysql_fetch_array($number))
{
$number1 = $bicycleinfo['sortbicycle'];
if($sortbicycle == "kid")
{
if($number1 == "boy")
{
$totaal .= "J " . $bicycle1 . ",";
}
elseif($number1 == "girl")
{
$totaal .= "M " . $bicycle1 . ",";
}
}
elseif($sortbicycle == "kids")
{
if ($number1 == "boy")
{
$totaal .= $bicycle1 . ",";
}
elseif($number1 == "girl")
{
$totaal .= $bicycle1 . ",";
}
}
elseif($number1 == $sortbicycle)
{
$totaal .= $bicycle1 . ",";
}
}
}
if($totaal > "1")
{
$amount1 = $total;
}
else
{
$amount1 = "";
}
return $amount1;
}
しかし、何らかの理由でこの部分:
if ($number1 == "boy")
{
$totaal .= "J " . $bicycle1 . ",";
}
elseif ($number1 == "girl")
{
$totaal .= "M " . $bicycle1 . ",";
}
}
elseif ($sortbicycle == "kids")
{
if ($number1 == "boy")
{
$totaal .= $bicycle1 . ",";
}
elseif ($number1 == "girl")
{
$totaal .= $bicycle1 . ",";
}
}
最初の部分は「子供」の部分が機能しますが、削除すると
$totaal .= "J " . $bicycle1 . ",";
に
$totaal .= $bicycle1 . ",";
私は何を間違っていますか?