yeah, is because the sql engine evaluates each passed parameter’s data type and not the whole statement on its own. So example:
datex=2020-10-13 fails because is looking for an string input for dates or datetime and is getting an invalid data type.
But when it gets
datex='2020-10-13' then it actually recieves a string which is the valid data type for dates.
So since we are already whitin a string in
$sql="select * form hotel where ...etc" we need to use either single quotes to represent a string whitin a string or scape the double quotes
$sql="select * form hotel where datex=\"2020-10-13\""
I prefer using the single quotes since escaping characters can be more confusing. I think it helps to think about it as if the first/outer/parent string is a string in the context of PHP but in the context of SQL the data types that matter are the ones passed to each parameter for the query.
Unfortunately some of this erros are not thrown by the engine and fail silently.