-3

this is my code

$customer->where(DATE_FORMAT(month,'%m')=date('m',strtotime('+1 month')));

how to get next month name ,i have try it. but i got the error this Can't use function return value in write context

Murad Hasan
  • 9,565
  • 2
  • 21
  • 42
sivakumar.s
  • 87
  • 1
  • 2
  • 14
  • 1
    Please do some research before asking question. If you have searched google you would have got this first link http://stackoverflow.com/questions/10514291/get-month-after-and-before-given-month-name – JiteshNK May 12 '16 at 12:40

1 Answers1

3

Just do this, You can get the next month from here and use it in where you want.

Online Test

$next_month = date('F',strtotime('next month')); // June

If you know the name of the last month then use-

$next_month = date('F',strtotime('June next month')); // July
Murad Hasan
  • 9,565
  • 2
  • 21
  • 42
  • actually my question is i have selected 5 month , i need display next month name – sivakumar.s May 12 '16 at 12:47
  • $customer = DB::table('customer'); $customer->join('customer_month_calender','customer_month_calender.customer_id','=','customer.id','left'); $customer->select('customer.id','customer_month_calender.month'); $customer->where(DATE_FORMAT(month,'%m')=date('m',strtotime('+1 month'))); $customer->orderBy('customer_month_calender.month', 'asc'); $customer->groupBy('customer.id'); return $customer->get(); – sivakumar.s May 12 '16 at 12:47
  • so you need to know the 5th month and name it before the `next`. like: `strtotime('may next month')` – Murad Hasan May 12 '16 at 12:54