Handling Decimal format

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • johny10151981
    replied
    Please read the syntax in the documentation
    Syntax for Decimal

    Name DECIMAL(M,D) // M>=D

    Leave a comment:


  • thatos
    replied
    When I do that, the table is not created, look at the code below.
    Code:
    $Isotope = "CREATE TABLE Isotope (
    	isotope_id int(2) NOT NULL auto_increment,
    	isotope_name varchar(50) NOT NULL,
    	state int(1) NOT NULL,
    	unit varchar(10) NOT NULL,
    	min_value decimal(3,6) NOT NULL,
    	max_value decimal(3,6) NOT NULL,
    	PRIMARY KEY (isotope_id)
    )";
    $results = mysql_query($Isotope);

    Leave a comment:


  • johny10151981
    replied
    the correct syntax is value decimal(3,6) not 3.6

    Leave a comment:


  • thatos
    started a topic Handling Decimal format

    Handling Decimal format

    I have the following create statement
    Code:
    $query = "CREATE TABLE P(
     code int(2) NOT NULL,
     value decimal(3.6) NOT NULL,
     PRIMARY KEY(code)
    
    ";
    but when I look at the data field using phpadmin, value is (3.0) , and when I insert a value say "123.123456 " this number gets converted to 123.

    I just want to know how to represent a decimal in an sql statement for mysql
Working...