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条)

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序