prepare($sql); $result->execute(); // echo (int)$result; $data = $result->fetch(PDO::FETCH_NUM); echo $data[0]; //Œ”•ช‚พ‚ฏUpdate‚ท‚้ $i = 0; for($i;$i<=$data[0];$i++){ // $data[0] ‚ชŒ” $stmt = $dbh->prepare("UPDATE test02 SET code = $i where country = :country"); $country = 'usa'; $stmt->bindParam(':country', $country, PDO::PARAM_STR); $res = $stmt->execute(); if ($res) { echo "XVŠฎ—น" .$i; } else { echo "XVŽธ”s"; } } } catch (PDOException $e) { var_dump($e->getMessage()); exit; } ?>