0

my update function

  # Update database
  public function _update($sql)
  {
    $stmt = $this->connection->prepare($sql);
    $stmt->execute();

    return $stmt;
  }

public $code ="";
public $table ="check_code";

$this->code = "PG-0000001";

# Start database connection
$connection = new Database(DB_HOST,DB_NAME,DB_USER,DB_PASS);

$code_sql = "UPDATE $this->table SET MAIL_CODE=$this->code";
$update_code = $connection->_update($code_sql);

my intention is to update my database but i have no idea what go wrong , the connection to database are ok , and when i change the code to

$code_sql = "UPDATE $this->table SET MAIL_CODE=1";

it update the database , what i did wrong here ?

my error here

**Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Champ 'OM' inconnu dans field list**
dee cheok
  • 257
  • 3
  • 17

0 Answers0