progetto201 API
|
DB_CONNECTION: manages database connection and queries. More...
Functions | |
dbconn ($dbname) | |
Connects to a database and returns errors or connection object. More... | |
queryToArray ($t_mysqli, $t_query) | |
This function executes the query and returns the data. More... | |
queryToJson ($t_mysqli, $t_query) | |
Returns data as JSON. More... | |
Variables | |
$db_dbname = "db100_100" | |
DB_CONNECTION: manages database connection and queries.
This script defines a function to connect to the database and two function that execute queries (one returns data in an array and the other as JSON)
dbconn | ( | $dbname | ) |
Connects to a database and returns errors or connection object.
This function connects to the database by reading credentials stored inside the 'credentials.ini' file.
string | $dbname | database name |
queryToArray | ( | $t_mysqli, | |
$t_query | |||
) |
This function executes the query and returns the data.
Executes the query, obtains data and stores it in an array, clears memory and returns the array
object | $t_mysqli | connection object |
string | $t_query | query to execute |
queryToJson | ( | $t_mysqli, | |
$t_query | |||
) |
Returns data as JSON.
Uses the queryToArray() to get data as an array and then encodes it into JSON.
object | $t_mysqli | connection object |
string | $t_query | query to execute |
$db_dbname = "db100_100" |