خرید بک لینک

Vote count: 0

I have a problem with one function, function should be sent a text to base (phpmyadmin), or menu displays error..

Error code:

Error: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'Code' caot be null

My funcktion:

public function UploadInvoice($CONN)
{
  $SubmitOK = '1';
  $Core = new Core();
  $Core->CheckForEmpty(array('Code'), 'finances.php');

  if($SubmitOK == '1') {
    try {
      $SQL = 'INSERT INTO Invoices (UserID, Code) VALUES (:UserID, :Code)';
      $SQL = $CONN->prepare($SQL);
      $SQL->execute(array('UserID' => $_SESSION['UserLogin']['ID'], 'Code' => $Code));
      $_SESSION['Success'] = 'Successfully submitted your code, Wait for checking multiple payments, your money will be soon on the bill';
      header('location: finances');
      exit();
    } catch(PDOException $e) {
       echo "Error: " . $e->getMessage();
    }
  } else {
      $_SESSION['Error'] = 'An error has occurred. Try again!';
      header('location: finances');
      exit();
  }
}

My form code:

<form action="" method="POST">
    <input type="text" class="form-control" required="true" minlength="4" name="Code" placeholder="Your ID">
    <button type="submit">SEND</button>
</form>

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 11 ارديبهشت 1395 ساعت: 15:01

صفحه بندی