Of course php is NOT insecure but you can't just call a DB function without adding security. Mostly it's not just calling some db functions from an app. There's more. And this is the strength of PHP (or any other server client). You can check if a request is valid/allowed (via user credentials/message signing, encryption, etc.). You can do enything with it.
Mostly apps directly calling db functions are not safe enough and not accepted by customers/security/regulation authorities, etc.