您好,我一直在考虑将单个变量用于多个命名占位符。我目前的代码在这里:
$checkSponsor = $conn->prepare("SELECT * FROM tables WHERE l1_1 = :sponsorID OR l1_2 = :sponsorID OR l1_3 = :sponsorID OR l1_4 = :sponsorID OR l1_5 = :sponsorID");
$checkSponsor->execute(array('sponsorID' => $sponsorid));
$row = $checkSponsor->fetch(PDO::FETCH_ASSOC);
if($row > 0) {
foreach ($checkSponsor as $s) {
echo $s['l1_1']."<br />";
echo $s['l1_2']."<br />";
echo $s['l1_3']."<br />";
echo $s['l1_4']."<br />";
echo $s['l1_5']."<br />";
}
}
我尝试了这段代码,没有任何回音。只是空白的白页。
由于我使用的是同一个占位符,我只能用一个变量执行数组吗?