Now when I call this login function in a bit of standalone php code it works fine but if I try and make this whole file a function to be called from another file it fails on this line within the login function. Does anyone know why this might be?
I still have a very basic knowledge of php tbh so I don't know whether I not aware of any particular rules surrounding objects/classses etc.
Look at the line where it is failing and then look for where the variables on that line are declared and assigned values, its likely that they are out of scope when you move this function to a stand alone module.
It will be caused by the scope of the variablesLook at the line where it is failing and then look for where the variables on that line are declared and assigned values, its likely that they are out of scope when you move this function to a stand alon