コード例 #1
0
ファイル: getAbonnements.php プロジェクト: kostya1017/our
<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');
//include "../includes/functions.php";
include "includes/db.php";
require_once "Objects/FunctionClass.php";
//$idrepresentant = 3;
$json = array();
$username = isset($_GET['username']) ? $_GET['username'] : "";
$password = isset($_GET['password']) ? $_GET['password'] : "";
try {
    $functionObject = new FunctionClass('./');
    $package_id = $functionObject->getPackageMembre($username, $password);
    $STH = $DBH->prepare("\n\t\tSELECT id, nom, prix_1, prix_3 \n\t\tFROM package \n\t\tWHERE deactivated = 0\n\t\t");
    $STH->execute();
    $STH->setFetchMode(PDO::FETCH_ASSOC);
    $STH2 = $DBH->prepare("\n\t\tSELECT id, type, amount \n\t\tFROM package_item  \n\t\tWHERE package_id = :idpackage \n\t\tORDER BY rank ASC\n\t\t");
    $STH3 = $DBH->prepare("\n\t\tSELECT id, type, itunes, google, prix_usd \n\t\tFROM prix \n\t\tWHERE id = :idprix\n\t\t");
    $x = 0;
    while ($row = $STH->fetch()) {
        //print_r($row);
        $temp_abonnement = array();
        $temp_abonnement['id'] = $row['id'];
        $temp_abonnement['nom'] = $row['nom'];
        $temp_abonnement['prix_1'] = array();
        $temp_abonnement['prix_3'] = array();
        $temp_abonnement['items'] = array();
        if ($package_id != NULL && $package_id == $row['id']) {
            $temp_abonnement['bought'] = 1;
        } else {