回答編集履歴

1

追記

2017/05/23 05:10

投稿

yambejp
yambejp

スコア114784

test CHANGED
@@ -3,3 +3,31 @@
3
3
  をしたときの[rowCount()](http://php.net/manual/ja/pdostatement.rowcount.php)を調べればいいのでは?
4
4
 
5
5
  すでにflagがfalseであれば更新がされないのでrouCountは0を返します
6
+
7
+
8
+
9
+ # 追記
10
+
11
+ 念の為ソース付けておきます
12
+
13
+
14
+
15
+ ```ここに言語を入力
16
+
17
+ $pdo = new PDO($dsn, $user,$password);
18
+
19
+ $sql="update table_name set flag =1 where id=?";
20
+
21
+ $stmt = $pdo->prepare($sql);
22
+
23
+ $stmt->execute([$id]);
24
+
25
+ if($stmt->rowCount()==1){
26
+
27
+ file_get_contents($url);
28
+
29
+ }
30
+
31
+ ```
32
+
33
+