guys, i got an error while saving or updating bank account number.
first, everything is ocay when i set my account into bigint (16) data type.
but, i changed it into varchar(16)
however,when i try to change it back to bigint suddenly the account number that i save before this became 2147483647 while what i want is 8988584864668848.

so, what data type is actually the most suitable for my account number ?
the same thing occur when i updating my data for identification card number (12)

rajarajan, i already used the bigint but i will get the same error.

when i try update the account number and the ic number, everything is ocay IF I DO IT IN THE PHPMYADMIN. the error occure when i try to update the number thru my web page that i built. is it cause by the design of my textfield or else ? please help me. the due date is going to be over soon :(

Member Avatar for rajarajan2017

Give a try to typecast the textfield values if you store directly.

$value=(int)textFieldValue

rajarajan, thank you very much for your reply.
but i cant understand how to write the "$value=(int)textFieldValue"
where i can put it ?
let me give you my code first where the account number should be :

<div align="left">
          <input name="no_ic" type="text" id="no_ic" />
        </div></td></tr>

and the account number

<div align="left">
          <input name="no_akaun" type="text" id="no_akaun" />
          </label>
          </div></td>

or should i put it on the dreamweaver tools for insert data?
such as:

<?php
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
  $MM_dupKeyRedirect="Wujud.php";
  $loginUsername = $_POST['nama'];
  $LoginRS__query = "SELECT nama FROM staff WHERE nama='" . $loginUsername . "'";
  mysql_select_db($database_data, $data);
  $LoginRS=mysql_query($LoginRS__query, $data) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);

  //if there is a row in the database, the username was found - can not add the requested username
  if($loginFoundUser){
    $MM_qsChar = "?";
    //append the username to the redirect page
    if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
    $MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
    header ("Location: $MM_dupKeyRedirect");
    exit;
  }
}

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO staff (nama, pangkat, no_patil, no_rumah, no_ic, no_akaun) VALUES (%s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['nama'], "text"),
                       GetSQLValueString($_POST['pangkat'], "text"),
                       GetSQLValueString($_POST['no_patil'], "int"),
                       GetSQLValueString($_POST['no_rumah'], "text"),
                       GetSQLValueString($_POST['no_ic'], "int"),
                       GetSQLValueString($_POST['no_akaun'], "int"));

  mysql_select_db($database_data, $data);
  $Result1 = mysql_query($insertSQL, $data) or die(mysql_error());

  $insertGoTo = "Berjaya.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>
Member Avatar for rajarajan2017

I really dont know, becoz the name of the input elements are not used anywhere in the php file

oh my...

It is diffcult to understand of your Comparison, I am learning.

use BIGINT as ur data type. i was having the same issue with my web app

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.