<?php
$username="root";
$password="";
$database="kuhadate";

mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die("Unable to select database");

$query = "SELECT *
FROM `ddate`
WHERE 1
LIMIT 0 , 30";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result)
?>

<input name = "date"  value="<?php echo $row['date']; ?>" type="text" />

[B]<input name = "month"  value="" type="text" />
<input name = "day"  value="" type="text" />
<input name = "year"  value="" type="text" />[/B]

so I'm currently being able to retrieve one and the only date in my database as soon as my page loads (testing stage, still) and thank you to one of the experts here that was able to help me. And now, I want to place the date to separate fields. To one of my textbox it's getting a value of 2010-07-29, now as you can see above the bold texts, I want also for it to be able to retrieve date but now [(07 = July)][(29 = the day)][(2010 = year)] thank you for the help experts.

<?php 
$disdate=explode("/","07/06/2010");
if($disdate[0]==01)
{
$month="january";
}
if($disdate[0]==02)
{
$month="february";
}
if($disdate[0]==03)
{
$month="march";
}
if($disdate[0]==04)
{
$month="april";
}
if($disdate[0]==05)
{
$month="may";
}
if($disdate[0]==06)
{
$month="june";
}
if($disdate[0]==07)
{
$month="july";
}
if($disdate[0]==08)
{
$month="august";
}
if($disdate[0]==09)
{
$month="september";
}
if($disdate[0]==10)
{
$month="october";
}
if($disdate[0]==11)
{
$month="november";
}
if($disdate[0]==12)
{
$month="december";
}
$day=$disdate[1];
$year=$disdate[2];
?>

<input name = "month"  value="<?php echo $month ?>" type="text" />
<input name = "day"  value="<?php echo $day ?>" type="text" />
<input name = "year"  value="<?php echo $year ?>" type="text" />

Here's a code that I managed to make it work (manually editing or putting the date in my php script here as can be seen).Now, the problem is I wanted to get the value of my date in my MySQL (database) is that possible? if it's possible, can you kindly help me with my problem thanks a lot. :)

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.