Help with search function

Does anyone know how I’m supposed connect to a database? Am I supposed to use php to handle the request and how would brightscript communicate with the database or php file to send the search request and receive the results…I know I’m supposed to use rourltransfer but I’m lost on how this is all supposed to work together…nothing seems to be working right.
I’m very new at this so some example code would help a lot.