2

I'm facing Invalid parameter number: parameter was not defined

It's because of this ?

and

  (
     (orders.hour_begin >= :begin_hour and orders.hour_final <= :hour_final )
     or 
     (orders.hour_begin <= :begin_hour and orders.hour_final > :hour_final  )
     or 
     (orders.date_final > :hour_final and orders.hour_final <= :hour_final  )
     or 
     (orders.hour_begin >= :begin_hour and orders.hour_final <= :hour_final )
     )

I define the same parameter in the array

array('begin_hour' => $begin_hour, 'hour_final' => $hour_final)

2 Answers2

5

You need to bind 8 separate parameters, even if the values are the same;

vpalade
  • 1,427
  • 1
  • 16
  • 20
0

This looks like the PDO parameters list is not matching with the parameters in the query. Try to ensure that the parameters list and parameters passed to the statement execute both have the same number of parameters.

This is a similar problem "Invalid parameter number: parameter was not defined" Inserting data