Results 1 to 4 of 4

Thread: xampp mysql date datatype problem

  1. #1
    Join Date
    Jun 2008
    Posts
    121
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default xampp mysql date datatype problem

    hi all

    i m using xampp.

    i have created a field column "dob" means date of birth in my mysql table and set the datatype to "date".

    I m fetching the result of the table from a php form. when i insert the date in the date input field say example 1982/10/10. everytime it displays result as 0000-00-00.

    why is it showing zeros

    vineet

  2. #2
    Join Date
    Nov 2007
    Location
    USA
    Posts
    170
    Thanks
    8
    Thanked 22 Times in 22 Posts

    Default

    Are you sure you are inserting the date into the database before you are trying to pull it out? If so could you show some code for some better help.

  3. #3
    Join Date
    Jun 2008
    Posts
    121
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default mysql date datatype

    Quote Originally Posted by Moshambi View Post
    Are you sure you are inserting the date into the database before you are trying to pull it out? If so could you show some code for some better help.

    Hi

    this is the mysql code that showsup when exported.

    -- phpMyAdmin SQL Dump
    -- version 2.11.4
    -- http://www.phpmyadmin.net
    --
    -- Host: localhost
    -- Generation Time: Oct 14, 2008 at 05:44 AM
    -- Server version: 5.0.51
    -- PHP Version: 5.2.5

    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

    --
    -- Database: `training`
    --

    -- --------------------------------------------------------

    --
    -- Table structure for table `student`
    --

    CREATE TABLE IF NOT EXISTS `student` (
    `student_id` int(11) NOT NULL auto_increment,
    `student_name` varchar(30) NOT NULL,
    `fee` float(9,2) NOT NULL,
    `dob` date NOT NULL,
    `age` int(3) NOT NULL,
    `picture` varchar(40) NOT NULL,
    PRIMARY KEY (`student_id`),
    UNIQUE KEY `student_name` (`student_name`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;

    --
    -- Dumping data for table `student`
    --

    INSERT INTO `student` (`student_id`, `student_name`, `fee`, `dob`, `age`, `picture`) VALUES
    (7, 'jumin', 7800.00, '0000-00-00', 23, ''),
    (3, 'sukh', 1600.00, '0000-00-00', 60, '74_106.JPG'),
    (5, 'makhinder', 7200.00, '0000-00-00', 99, '06_120.JPG'),
    (6, 'hemu', 1250.00, '0000-00-00', 52, '');

  4. #4
    Join Date
    Apr 2006
    Posts
    190
    Thanks
    3
    Thanked 7 Times in 7 Posts

    Default

    can you post your php code?
    Ryan
    Sevierville, TN

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
  •