如何在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