我希望能够将生日与mysql数据分隔为日,年和月。 在html中使用3文本框。我如何分开它?我试图想我能与下面的代码做证明我想要的结果:如何在php中分隔日期
这里的HTML表单与PHP代码:
$idnum = mysql_real_escape_string($_POST['idnum']);
mysql_select_db("school", $con);
$result = mysql_query("SELECT * FROM student WHERE IDNO='$idnum'");
$month = mysql_real_escape_string($_POST['mm']);
?>
<?php while ($row = mysql_fetch_array($result)) { ?>
<tr>
<td width="30" height="35"><font size="2">Month:</td>
<td width="30"><input name="mo" type="text" id="mo" onkeypress="return handleEnter(this, event)" value="<?php echo $month = explode("-",$row['BIRTHDAY']);?>">
正如你所看到的列mysql数据库被称为BIRTHDAY。使用这种格式:
YYYY-MM-DD
我该怎么做。这样来自单列的数据将被分成三部分? 请帮助谢谢,