0
0

More than 1 year has passed since last update.

PHP フォルダ 削除関数

Posted at

完成イメージ図

tttt0001.png

ソースコード

 //*********************** */
        //**************** DB カラム 削除 関数 */
    //*********************** */
    function DB_delete_column($p_h) {

        // *** エックスサーバー用 接続情報
        $dsn = 'mysql:dbname=サーバー;host=localhost;port=3306';
        $user = '';
        $password = '';

        try{

            // PDO オブジェクト作成
            $pdo = new PDO($dsn, $user, $password);

            // ======  (トランザクション) トランザクション開始 ======
            $pdo->beginTransaction();
            
            //***** GET の末尾の URL を取って、 最新の1件 取得 */
            $stmt = $pdo->prepare("DELETE FROM valid_table WHERE pass_hh = :pass_hh");
            
            // パスワード ハッシュ値
            $stmt->bindParam(':pass_hh', $p_h, PDO::PARAM_STR);

            $stmt->execute();

            // ======= (トランザクション) コミット =========
            $pdo->commit();
        
        }catch (PDOException $e){
            print('Error:'.$e->getMessage());

            // ======= (トランザクション) ロールバック =========
            $pdo->rollBack();

            die();
        }
    
            
            $pdo = null;
            // ****** データベースの接続解除 ******
         /**========== DB 接続 END =========== */

    } // =========================== END function DB_delete_column()
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0