[guadec-web] Testing database update: Trial 1



commit 30223c6c664bb964535b269247fb1433c8d8cc45
Author: Saumya Dwivedi <saumya zero gmail com>
Date:   Tue Jul 8 14:40:02 2014 +0530

    Testing database update: Trial 1

 guadec/ipn.php         |    1 +
 guadec/ipnlistener.php |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/guadec/ipn.php b/guadec/ipn.php
index 1c86989..ae71e51 100755
--- a/guadec/ipn.php
+++ b/guadec/ipn.php
@@ -102,6 +102,7 @@ if ($verified) {
         var_dump($wpdb);
         $table_name = $wpdb->prefix .'guadec2014_registration';
         error_log($table_name);     // check if the wpdb is accessible
+        $listener->updateCompleted($reg_email);
         // $wpdb->update(
         // $table_name,
         // array(
diff --git a/guadec/ipnlistener.php b/guadec/ipnlistener.php
index 140a8ff..de4b679 100755
--- a/guadec/ipnlistener.php
+++ b/guadec/ipnlistener.php
@@ -12,6 +12,8 @@
  *  @copyright  (c) 2012 - Micah Carrick
  *  @version    2.1.0
  */
+
+global $wpdb;
 class IpnListener {
     
     /**
@@ -307,4 +309,21 @@ class IpnListener {
             throw new Exception("Invalid HTTP request method.");
         }
     }
+    public function updateCompleted($reg_email='dummy mail com') {
+    
+        $table_name = $wpdb->prefix .'guadec2014_registration';
+     //   error_log($table_name);     // check if the wpdb is accessible
+        $up = $wpdb->update(
+        $table_name,
+        array(
+            'payment' => 'Completed'
+            ),
+        array(
+            'email' => $reg_email
+            ) 
+        );
+        if(!($up)){
+            throw new Exception("Database Error: Not Updated");
+        }
+    }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]