-1

This is the code I'am using to try and update the SQL data. I keep getting an error can anyone show me the right code to use?

In there documentation they said it should return a 1 if it pass and a 0 if it fails http://offertoro.com/docs/postback

The code is for the Offertoro offer wall and I really would like to get it working with my website so I can finally give my user more to do :) Any help is greatly appreciated. Thank you very much

<?php
$servername = "ooo";
$username = "ooo";
$password = "ooo";
$dbname = "ooo";

try {
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$id = $_GET["id"]; 
$old = $_GET["old"]; 
$o_name = $_GET["o_name"]; 
$amount = $_GET["amount"]; 
$cy_name = $_GET["cy_name"];
$user_id = $_GET["user_id"];
$sig = $_GET["sig"]; 
$payout = $_GET["payout"]; 

if(!isset($_SESSION['username'])) {
    echo '<script type="text/javascript" language="Javascript">  
    alert("Not Logged In")  
    </script> ';
}else{

        $result = mysql_query("SELECT meta_value FROM eiwi_usermeta WHERE user_id LIKE '$user_id' LIMIT 1" );
        $row = mysql_fetch_object($result);
        $meta_value = $row->meta_value;
        $meta_value = $meta_value + $amount;

    mysql_query("UPDATE eiwi_usermeta SET meta_value='$meta_value' WHERE user_id LIKE '$user_id' LIMIT 1");

if(!$query->execute())
            $result = 0;  // Problems executing SQL. Fail.
        $dbh = null;
    }
    } catch (PDOException $e) {


}else{
      $result = 0; // Security hash incorrect. Fail.
    return $result;

1 Answers1

0

You did not used and closed the else condition properly here

   catch (PDOException $e)
      {    
       }else{
    $result = 0; // Security hash incorrect. Fail.
    return $result;
sujivasagam
  • 1,659
  • 1
  • 14
  • 26