progetto201 API
Functions | Variables
columnnames.php File Reference

COLUMNNAMES: manages columns' names. More...

Functions

 getColumNames ($t_conn_res)
 Returns the name of the colums in a data table. More...
 

Variables

 $response = array("errors" => array())
 Prepare default response array with no errors. More...
 
 $nodetypes = array("0" => "t_type0_data")
 

Detailed Description

COLUMNNAMES: manages columns' names.

Client perspective:

Description

This script sets the returned content type to JSON, includes the db_connection.php script

It is used to connect to MySQL and execute basic SELECT queries

and then defines the response array.

One function is defined:

 getColumNames()

Returns the name of the colums in a data table.

If the script isn't included it tries to connect to the database, and checks the request method:

When the called function ends the connection to the DB gets terminated, and data (or errors) is collected inside the response array. The response array gets echoed to the client in JSON format

Errors list:

Since
01_01
Author
Stefano Zenaro (https://github.com/mario33881)

Function Documentation

◆ getColumNames()

getColumNames (   $t_conn_res)

Returns the name of the colums in a data table.

First it checks that typeid is set both in the request and in the $nodetypes array, then a SELECT query is executed to retrieve the column names.

Parameters
array$t_conn_resarray with the DB connection object
Returns
array $action_res array with errors or data

Variable Documentation

◆ $nodetypes

$nodetypes = array("0" => "t_type0_data")

◆ $response

$response = array("errors" => array())

Prepare default response array with no errors.