progetto201 API
|
PLANLABELS: manages plan's labels. More...
Functions | |
post_labels ($t_conn_res) | |
Inserts/removes label data to the database. More... | |
get_labels ($t_conn_res) | |
Returns labels data. More... | |
Variables | |
$response = array("errors" => array()) | |
Prepare default response array with no errors. More... | |
PLANLABELS: manages plan's labels.
Client perspective:
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.
Two functions are defined:
post_labels()
Inserts/removes label data to the database.
get_labels()
Returns labels data
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:
get_labels | ( | $t_conn_res | ) |
Returns labels data.
The function executes a SELECT query to select the labels data.
array | $t_conn_res | array with the DB connection object |
post_labels | ( | $t_conn_res | ) |
Inserts/removes label data to the database.
The function checks if all the parameters have been passed inside the request.
Then it tries to insert the data and if the data is a duplicate, it updates the old data.
If the client sends only an id and a remove parameter, the function tries to remove the label from the table
array | $t_conn_res | array with the DB connection object |
should log the SQL error to a file... (should also log everything else)
the "error" 1110 should be a warning
$response = array("errors" => array()) |
Prepare default response array with no errors.