0
我想從if語句獲取mysql語句結果的子集,並且如果序列中的最後一個應用適當的代碼。爲什麼我的循環不遞增?
我想設置兩個增量,然後如果($ secondcount> $ totalcount)執行其他操作。
MySqlNUMRows將無法正常工作,因爲它是子集,在這種情況下,我也不會看到where子句。任何人都可以看到原因?
$counting = 0;
while($thisrow = mysqli_fetch_array($sqlchangenamesresult))
{
$change_name = $thisrow['change_name'];
#count the updating results
if(strstr($row['Content_lists'], $change_name) != FALSE)
{
$counting++;
}
$totalcount = $counting;
$secondcount = 0;
if(strstr($row['Content_lists'], $change_name) != FALSE)
{
if($secondcount > $totalcount)
{
echo '<br>' .$secondcount. '<br>' . $totalcount;
$sqlinsert .= $thisrow['change_name'];
$sqlinsert2 .= 'Yes';
$secondcount++;
}
else
{
echo '<br>' .$secondcount. '<br>' . $totalcount;
$sqlinsert .= $thisrow['change_name'] . ', ';
$sqlinsert2 .= 'Yes, ';
$secondcount++;
}
}
對於每個循環,您總是使用零重新初始化$ secondcount。 – enricog
哪裏是你的sql查詢爲什麼havnt你沒有把它包含在這段代碼中?你的表中有change_name嗎? –
?............................... –