Ignore:
Timestamp:
03/24/21 22:28:33 (4 years ago)
Author:
tbretz
Message:
Updated mysql calls.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/www/schedule/load.php

    r18720 r20052  
    99// ================================================================
    1010
    11 function query($query)
     11function query($sql, $query)
    1212{
    13    $sql = mysql_query($query);
     13   $sql = $sql->query($query);
    1414   if (!$sql)
    15         die(mysql_error());
     15        die($sql->error);
    1616
    1717   $rows = array();
    18    while($row = mysql_fetch_assoc($sql))
     18   while($row = $sql->fetch_assoc())
    1919      $rows[] = $row;
    2020
     
    4343require_once 'config.php';
    4444
    45 $db = mysql_connect($dbhost,$dbuser,$dbpass);
    46 if (!$db)
    47    die(mysql_error());
     45$sql = new mysqli($dbhost, $dbuser, $dbpass);
    4846
    49 if (!mysql_select_db($dbname, $db))
    50    die(mysql_error());
     47if ($sql->connect_error)
     48    die($sql->connect_error);
     49
     50if (!$sql->select_db($dbname))
     51    die($sql->error);
    5152
    5253/*mixed date_sunrise ( int $timestamp [, int $format = SUNFUNCS_RET_STRING [, float $latitude = ini_get("date.default_latitude") [, float $longitude = ini_get("date.default_longitude") [, float $zenith = ini_get("date.sunrise_zenith") [, float $gmt_offset = 0 ]]]]] )*/
    5354
    54 query("SELECT DISTINCT(DATE(ADDTIME(fStart, '-12:00'))) AS 'd' FROM Schedule");
    55 query("SELECT fSourceKEY AS 'key', fSourceName AS 'val' FROM Source WHERE fSourceTypeKEY=1");
    56 query("SELECT fMeasurementTypeKEY AS 'key', fMeasurementTypeName AS 'val' FROM MeasurementType");
    57 query("SELECT * FROM Schedule WHERE DATE(ADDTIME(fStart, '-12:00:00')) = '".$_POST['n']."'".$cut."ORDER BY fStart ASC, fMeasurementID ASC");
     55query($sql, "SELECT DISTINCT(DATE(ADDTIME(fStart, '-12:00'))) AS 'd' FROM Schedule");
     56query($sql, "SELECT fSourceKEY AS 'key', fSourceName AS 'val' FROM Source WHERE fSourceTypeKEY=1");
     57query($sql, "SELECT fMeasurementTypeKEY AS 'key', fMeasurementTypeName AS 'val' FROM MeasurementType");
     58query($sql, "SELECT * FROM Schedule WHERE DATE(ADDTIME(fStart, '-12:00:00')) = '".$_POST['n']."'".$cut."ORDER BY fStart ASC, fMeasurementID ASC");
    5859
    5960//sleep(3);
Note: See TracChangeset for help on using the changeset viewer.