duangao8359 2016-08-30 11:04
浏览 40
已采纳

根据当前日期提交表单时,在phpmyadmin数据库中插入周数

I want to upload current week number in the database without showing it anywhere in the site when users submit a form. Although I do want to use the week number later to show "Winners of week XX" (main reason I want it uploaded to database). At this time I have created a form which does not refresh the page when submitted to the database. In phpmyadmin I have created a field called Week with type INT. If needed I can of course change this according to working code suggestions. I have spent the last 2 days searching the web and trying to make this work, but finally I decided to join the community and ask about it here. Any suggestions?

Do tell if anyone need me to specify some code. At this time I'm working with script in the index.html and PHP in a separate file.

Problem solved: $weekNumber = date("W"); worked like a charm.

  • 写回答

2条回答 默认 最新

  • doutan8601 2016-08-30 11:10
    关注

    You can get week number by php function date as below and can insert it in DB as per your requirement.

    $weekNumber = date("W"); 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?