我在的foreach在PHP得到这个错误:腓的foreach错误无效参数
在...
代码的foreach()提供的参数无效:
$database = new PDO('mysql:host=localhost;dbname=staff_tool', $user, '');
foreach ($database->query('SELECT id,firstname,lastname FROM `staff` SET categorie_bit = 0') as $testx) {
var_dump($testx);
}
编辑代码:
foreach ($database->query('SELECT id,firstname,lastname,categorie_bit FROM `staff` WHERE categorie_bit = 1 SET categorie_bit = 0') as $testx) {
var_dump($testx);
}
并查询返回任何东西? –
不只是警告信息 – as21
您的新PDO是否返回任何内容?因为我看不到任何错误检查... – Amarnasan