开发者

How to load mysql data on separate forms

I used this code to add the data in the mysql table. But I do not know how to separate them because they are only stored in one column:

$birthday = mysql_real_escape_string($_PO开发者_如何学CST['yyyy'] . '-' . $_POST['mm'] . '-' . $_POST['dd']); 

How do I load them in here, so that the month, day, and year will be separated:

<tr>
<td><font size="2">Birthday</td>
<td>
 <select title="- Select Month -" name="mm" id="mm" class="" > 
                              <option value=""  >--Month--</option> 
                              <option value="1" >Jan</option> 
                              <option value="2"  >Feb</option> 
                              <option value="3"  >Mar</option> 
                              <option value="4"  >Apr</option> 
                              <option value="5"  >May</option> 
                              <option value="6"  >Jun</option> 
                              <option value="7"  >Jul</option> 
                              <option value="8"  >Aug</option> 
                              <option value="9"  >Sep</option> 
                              <option value="10"  >Oct</option> 
                              <option value="11"  >Nov</option> 
                              <option value="12"  >Dec</option> 
                              </select> 
                      <input title="Day" type="text" onkeypress="return isNumberKey(event)" name="dd" value="" size="1" maxlength="2" id='numbers'/ > 
                      <input title="Year" type="text" onkeypress="return isNumberKey(event)" name="yyyy"  value="" size="1"  maxlength="4" id='numbers'/> </td>
    </tr>

Please help.


Are you asking separate in mysql right?

For Year

SELECT EXTRACT(YEAR FROM '1999-07-02');

Output is 1999

For Month

SELECT EXTRACT(MONTH FROM '1999-07-02');

Output is 7

For Day

SELECT EXTRACT(DAY FROM '1999-07-02');

Output is 2

Is it ok ?


Took me half a hour to figure your question. I'm still not sure though

list($year,$month,$day) = explode("-",$row['birthday']);

where $row['birthday'] coming from the database.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜