【PHP】下らねぇ質問はID出して書き込みやがれ 81at PHP【PHP】下らねぇ質問はID出して書き込みやがれ 81 - 暇つぶし2ch■コピペモード□スレを通常表示□オプションモード□このスレッドのURL■項目テキスト290:nobodyさん 09/02/22 21:54:35 3nGhqmkB 1.php のソースは以下の通りです <?php try { $oDbCxn = new PDO('sqlite:test1'); $oDbCxn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { die("Error connecting to DB"); } $bUpdatePending = true; while ($bUpdatePending) { try { $oDbCxn->beginTransaction(); $oDbCxn->exec("UPDATE tb1 SET value = value + 1 WHERE id = '1'"); sleep(10); $oDbCxn->commit(); $bUpdatePending = false; // Exit the loop now the update has been done } catch (PDOException $e) { // Update failed. Wait a while before trying again in the next loop } } ?> 291:nobodyさん 09/02/22 21:55:09 3nGhqmkB 2.phpは、以下の通りです <?php try { $oDbCxn = new PDO('sqlite:test1'); $oDbCxn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { die("Error connecting to DB"); } $bUpdatePending = true; while ($bUpdatePending) { try { $oDbCxn->beginTransaction(); $oDbCxn->exec("UPDATE tb1 SET value = value + 1 WHERE id = '1'"); $oDbCxn->commit(); $bUpdatePending = false; // Exit the loop now the update has been done } catch (PDOException $e) { // Update failed. Wait a while before trying again in the next loop sleep(15); } } ?> 次ページ最新レス表示レスジャンプ類似スレ一覧スレッドの検索話題のニュースおまかせリストオプションしおりを挟むスレッドに書込スレッドの一覧暇つぶし2ch