Exemplo n.º 1
0
function getPowerArrayForLens($lensID)
{
    $sql = "\n\tSELECT *\n\tFROM pn_lenses_powers\n\tWHERE lensID = {$lensID} \n\t";
    $results = doQuery($sql);
    //print_r($results);
    //$returnArray = array();
    if ($results['head']['status'] == 1) {
        $powerLists = makeLists($results['body']);
        //print_r($powerLists);
        if ($powerLists) {
            $returnArray = array('head' => array('status' => '1', 'error_number' => '', 'error_message' => ''), 'body' => $powerLists[$lensID]);
        }
    }
    if (!isset($returnArray)) {
        $returnArray = array('head' => array('status' => '0', 'error_number' => '404', 'error_message' => 'Data not found'), 'body' => array());
    }
    // print_r($returnArray);
    return $returnArray;
}
Exemplo n.º 2
0
                                </div>


           


                                  </div>
                                  
                                  <div class="demo-options mdl-shadow--2dp mdl-color--white mdl-cell mdl-cell--6-col">
                                  
                                                  <div>
                                                       <label>Continents</label>
                                                            <select id="continents">
                                                                 <option value="" disabled selected>Choose your option</option>
                                                                 <?php 
makeLists($result3);
?>
                                                          </select>
                                                </div>

                                                <div id="spinner" class="mdl-spinner mdl-js-spinner is-active"></div>
                                          

                                                  <table id="table" class="mdl-data-table mdl-js-data-table">
                                                    <thead>
                                                    <tr>
                                                      <th class="mdl-data-table__cell--non-numeric">City</th>
                                                      <th>Visits</th>
                                                    </tr>
                                                  </thead>
                                                  <tbody id="tbody">
Exemplo n.º 3
0
function updatePowerListsTable($lensID)
{
    //return;
    $mysqli = DBAccess::getConnection();
    //$mysqli = new mysqli('mysql.eyedock.com', 'eyedockdatauser', 'kvBS^VQR', 'eyedock_data');
    //$mysqli = new mysqli('mysql.eyedock.com', 'eyedockdatauser', 'kvBS^VQR', 'eyedock_data');
    //get the rows from lenses_powers table for this lens (these values are listed in ranges)
    $sql = "SELECT * FROM pn_lenses_powers WHERE lensID = {$lensID} ";
    $result = $mysqli->selectQuery($sql);
    $resultArr[] = $result->fetch_array(MYSQLI_ASSOC);
    $powerArray = makeLists($resultArr);
    foreach ($powerArray[$lensID] as $row) {
        //create the data to insert into the power_lists table
        $id = $row['id'];
        $lensID = $row['lensID'];
        $variation = $row['variation'];
        $baseCurve = implode(",", $row['baseCurve']);
        $diameter = implode(",", $row['diameter']);
        $sphere = implode(",", $row['sphere']);
        if ($row['cylinder'] != "") {
            $cylinder = implode(",", $row['cylinder']);
        }
        if ($row['axis'] != "") {
            $axis = implode(",", $row['axis']);
        }
        if ($row['addPwr'] != "") {
            $addPwr = implode(",", $row['addPwr']);
        }
        if ($row['colors_enh'] != "") {
            $colors_enh = implode(",", $row['colors_enh']);
        }
        if ($row['colors_opq'] != "") {
            $colors_opq = implode(",", $row['colors_opq']);
        }
        //check to see if the rows already exist in the power_lists table
        $sql = "SELECT 1 FROM pn_lenses_power_lists WHERE id =" . $row['id'];
        $result = $mysqli->selectQuery($sql);
        $count = $result->num_rows;
        //echo "<p>sql: " . $sql . "</p>";
        //echo "<p>count: " . $count . "</p>";
        if ($count < 1) {
            $insertSQL = "INSERT INTO pn_lenses_power_lists (id, lensID, variation, baseCurve, diameter, sphere, cylinder, axis, addPwr, colors_enh, colors_opq) \n\t\tVALUES (\n\t\t\n\t\t\t" . $id . " , \n\t\t\t" . $lensID . ",\n\t\t\t'" . $variation . "', \n\t\t\t'" . $baseCurve . "',\n\t\t\t'" . $diameter . "', \n\t\t\t'" . $sphere . "', \n\t\t\t'" . $cylinder . "', \n\t\t\t'" . $axis . "', \n\t\t\t'" . $addPwr . "', \n\t\t\t'" . $colors_enh . "', \n\t\t\t'" . $colors_opq . "'\n\t\t)";
        } else {
            //if the row did exist we'll update it
            $insertSQL = "UPDATE pn_lenses_power_lists SET \n\t\t\tid = " . $id . ", \n\t\t\tlensID = " . $lensID . ", \n\t\t\tvariation = '" . $variation . "', \n\t\t\tbaseCurve = '" . $baseCurve . "', \n\t\t\tdiameter = '" . $diameter . "', \n\t\t\tsphere = '" . $sphere . "',\n\t\t\tcylinder = '" . $cylinder . "', \n\t\t\taxis = '" . $axis . "', \n\t\t\taddPwr = '" . $addPwr . "', \n\t\t\tcolors_enh = '" . $colors_enh . "', \n\t\t\tcolors_opq = '" . $colors_opq . "' \n\t\t\t WHERE id = " . $id . "\n\t\t\t";
        }
        //echo ($insertSQL);
        $resultarr[] = $mysqli->selectQuery($insertSQL);
    }
    // go to the next row . . .
    return $resultarr;
}