Submit Your Article Forum Rules

Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Show date from field

  1. #11
    WebProWorld MVP DaveSawers's Avatar
    Join Date
    Dec 2006
    Location
    Lunenburg, Nova Scotia, Canada
    Posts
    762
    What do you mean by "PHP submission"?
    Dynamic Software Development
    www.activeminds.ca

  2. #12
    WebProWorld MVP edhan's Avatar
    Join Date
    Aug 2003
    Posts
    941
    Quote Originally Posted by edhan
    I have created a database Table with 2 fields - date1 and person.
    Field in column for date1 is 19790103, 19710304, 20010923, etc. And the field for Person in column is Peter, Andrew, William, etc corresponding to their date of birth.

    What I want to do next will be extracting the date to show in HTML as: Birthdate: 01 03, 1979 for Peter when I submit this in the form with that date of birth. This form in php submission using:

    <SELECT NAME="day1"> with option 1 to 31
    <SELECT NAME="month1"> with option 1 to 12
    <SELECT NAME="year1"> with option 1950 to 2011

    Hope this explanation is clear. I am just starting to write this and encountering the problem of not able to echo the birthdate when selecting the birth date upon submission.
    PHP submission means I have a form named as check.php with the form created to select the birthdate and submit online to show the result.
    Find Out More About Renting Thai Amulets For Blessing Of Protection in Well Being & Wealth | Destiny of Fate | Exploring, Understanding & Learning The Basic Feng Shui Art Of Placement To Build Wealth & Harmony With Friends, Colleagues And Family Members In Relationships & Careers... Do you want a better lifestyle? Check it out today!

  3. #13
    Junior Member
    Join Date
    Mar 2006
    Posts
    11
    OK - maybe it's just me, but are you SELECTing the $date1 from the database and then not able to get the $birthdate from that? If so, the reason might be that $year1, $month1 and $day1 are not assigned any values just because you got $date1 and reconstructed how it was created.

    You probably need something like this

    Code:
    	$db = @mysql_connect('localhost', 'dbuser', 'dbpass');
    	@mysql_select_db('dbname', $db);
    
    	$result = mysql_query("SELECT * FROM  `match` WHERE `person` = '$person'", $db);
    	$row = mysql_fetch_assoc($result);
    
            $year1 = substr($row[date1],0,4);
            $month1 = substr($row[date1],4,2);
            $day1 = substr($row[date1],6,2);
    
            $birthdate1 = " (Birthdate: ".$month1." ".$day1.", ".$year1.") ";
    I hope this helps,
    Rob

  4. The following user agrees with ramorius:
  5. #14
    WebProWorld MVP edhan's Avatar
    Join Date
    Aug 2003
    Posts
    941
    Quote Originally Posted by ramorius View Post
    OK - maybe it's just me, but are you SELECTing the $date1 from the database and then not able to get the $birthdate from that? If so, the reason might be that $year1, $month1 and $day1 are not assigned any values just because you got $date1 and reconstructed how it was created.

    You probably need something like this

    Code:
    	$db = @mysql_connect('localhost', 'dbuser', 'dbpass');
    	@mysql_select_db('dbname', $db);
    
    	$result = mysql_query("SELECT * FROM  `match` WHERE `person` = '$person'", $db);
    	$row = mysql_fetch_assoc($result);
    
            $year1 = substr($row[date1],0,4);
            $month1 = substr($row[date1],4,2);
            $day1 = substr($row[date1],6,2);
    
            $birthdate1 = " (Birthdate: ".$month1." ".$day1.", ".$year1.") ";
    I hope this helps,
    Rob
    Yes. Thank you very much. It is resolved!
    Find Out More About Renting Thai Amulets For Blessing Of Protection in Well Being & Wealth | Destiny of Fate | Exploring, Understanding & Learning The Basic Feng Shui Art Of Placement To Build Wealth & Harmony With Friends, Colleagues And Family Members In Relationships & Careers... Do you want a better lifestyle? Check it out today!

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

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