Subversion Repository Public Repository

Nextrek

Diff Revisions 507 vs 579 for /Android/SmartCharging/endPoints/get_commenti.php

Diff revisions: vs.
  @@ -2,11 +2,13 @@
2 2 header("Access-Control-Allow-Origin: *");
3 3 header('Content-Type: application/json; charset=UTF-8');
4 4
5 + require_once("constants.php");
6 +
5 7 require_once("repositories/CommentRepository.php");
6 8
7 - $servername = "localhost";
9 + /*$servername = "localhost";
8 10 $username = "smartcharging";
9 - $password = "LXRLBaEAuRr7M7jY";
11 + $password = "LXRLBaEAuRr7M7jY";*/
10 12
11 13 //$params = json_decode($_REQUEST["params"], true);
12 14
  @@ -19,7 +21,7 @@
19 21 $comments;
20 22
21 23 try {
22 - $conn = new PDO("mysql:host=".$servername.";dbname=smartcharging", $username, $password);
24 + $conn = new PDO("mysql:host=".DB_SERVERNAME.";dbname=".DB_NAME, DB_USERNAME, DB_PASSWORD);
23 25 $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
24 26 //echo "Connesso con successo al DB";
25 27
  @@ -34,8 +36,9 @@
34 36 catch(PDOException $e)
35 37 {
36 38 echo $e->getMessage();
37 - $risposta["id"] = -1;
38 - $risposta["comments"] = null;
39 + $risposta = createErrorMessage(1, "Errore DB");
40 + /*$risposta["id"] = -1;
41 + $risposta["comments"] = null;*/
39 42 }
40 43
41 44 echo json_encode($risposta);