Results 1 to 3 of 3

Thread: dynamic text field/mysql

  1. #1
    Join Date
    Jul 2008
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default dynamic text field/mysql

    I have a dynamic text field that gets a price entered into. When the form is submitted, the database (MYSQL) shows it as a rounded number.

    For Example:

    entered price is 5.95
    in the mysql database the data says 5

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    PHP floor().
    Last edited by Nile; 07-18-2008 at 12:34 PM.
    Jeremy | jfein.net

  3. #3
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    It sounds like your table schema is wrong. The column it is being stored in is probably defined as "price INT" as opposed to "price FLOAT(11)". Since integers can not contain decimal points, MySQL is truncating the information, and storing just the whole integer portion.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •