-3

This is my code , everything works fine except $w which should be present week number .

  $w="WEEKOFYEAR()"; 

I have declared everything and my code works when i hard code the week number

$w=13;

insert($actual,$target['value'],$country,$ini,$goal ,$comment,$an,$w,$con);

I get the following error : Instead of it showing week number 13; it is starting from 0

John Conde
  • 217,595
  • 99
  • 455
  • 496
Sai Vignesh
  • 41
  • 1
  • 1
  • 7

2 Answers2

0

The problem is that WEEKOFYEAR() is not a default PHP function. Use date() to get the present week number.

$w = date('W');

Note that the "W" is a capital W, it makes a difference.

Also, check out the PHP documentation for date(): http://php.net/manual/en/function.date.php

Chris Bier
  • 14,183
  • 17
  • 67
  • 103
0

If you want to get the current week, you may try this

$weekNumber = date("W"); 

Doc: http://php.net/manual/en/function.date.php

TheEwook
  • 11,037
  • 6
  • 36
  • 55