如何在PHP中將爆炸字與mysql varchar進行比較?
此代碼產生我想要什麼,但它也給這個錯誤PHP - 在PHP中將爆炸字與mysql varchar進行比較
veranderenwachtwoordjij
致命錯誤:調用一個成員函數FETCH_ASSOC()一個非對象......
$word = "Also, to be safe, change your password regularly... you don't have to be obsessive about it: every three hours or so should be enough. And because erring on the side of caution is always a good idea, fake your own suicide and change your identity at least once a year.";
$pieces = explode(" ", $word);
$x = 0;
while($x < word_count($word)) { // word count function returns int (51)
$aPiece = $pieces[$x]; // change $pieces[$x] to 'you' and then it works
$result = $conn->query("SELECT * FROM dict WHERE english='$aPiece'");
$z = 0;
while($z < $num_result) // $num_result returns amount of rows in database
{
$row = $result->fetch_assoc(); //error line is here
echo stripslashes($row['dutch']);
$z++;
}
$x++;
}
自從我做任何PHP以來,這已經很長時間了。他們是否棄用'for'循環? – Johnsyweb 2010-09-06 09:41:45