Changeset 20052 for trunk/FACT++
- Timestamp:
- 03/24/21 22:28:33 (4 years ago)
- Location:
- trunk/FACT++/www/schedule
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/schedule/load.php
r18720 r20052 9 9 // ================================================================ 10 10 11 function query($ query)11 function query($sql, $query) 12 12 { 13 $sql = mysql_query($query);13 $sql = $sql->query($query); 14 14 if (!$sql) 15 die( mysql_error());15 die($sql->error); 16 16 17 17 $rows = array(); 18 while($row = mysql_fetch_assoc($sql))18 while($row = $sql->fetch_assoc()) 19 19 $rows[] = $row; 20 20 … … 43 43 require_once 'config.php'; 44 44 45 $db = mysql_connect($dbhost,$dbuser,$dbpass); 46 if (!$db) 47 die(mysql_error()); 45 $sql = new mysqli($dbhost, $dbuser, $dbpass); 48 46 49 if (!mysql_select_db($dbname, $db)) 50 die(mysql_error()); 47 if ($sql->connect_error) 48 die($sql->connect_error); 49 50 if (!$sql->select_db($dbname)) 51 die($sql->error); 51 52 52 53 /*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 ]]]]] )*/ 53 54 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");55 query($sql, "SELECT DISTINCT(DATE(ADDTIME(fStart, '-12:00'))) AS 'd' FROM Schedule"); 56 query($sql, "SELECT fSourceKEY AS 'key', fSourceName AS 'val' FROM Source WHERE fSourceTypeKEY=1"); 57 query($sql, "SELECT fMeasurementTypeKEY AS 'key', fMeasurementTypeName AS 'val' FROM MeasurementType"); 58 query($sql, "SELECT * FROM Schedule WHERE DATE(ADDTIME(fStart, '-12:00:00')) = '".$_POST['n']."'".$cut."ORDER BY fStart ASC, fMeasurementID ASC"); 58 59 59 60 //sleep(3); -
trunk/FACT++/www/schedule/save.php
r18797 r20052 134 134 // ================================================================ 135 135 136 $db = mysql_connect($dbhost,$dbuser,$dbpass);137 if ( !$db)138 die( mysql_error());139 140 if (! mysql_select_db($dbname, $db))141 die( mysql_error());136 $db = new mysqli($dbhost,$dbuser,$dbpass); 137 if ($db->connect_error) 138 die($db->connect_error); 139 140 if (!$db->select_db($dbname)) 141 die($db->error); 142 142 143 143 $query = "SELECT * FROM MeasurementType"; 144 144 145 $sql = mysql_query($query);145 $sql = $db->query($query); 146 146 if (!$sql) 147 die( mysql_error());147 die($db->error); 148 148 149 149 $measurements = array(); 150 while($row = mysql_fetch_assoc($sql))150 while($row = $db->fetch_assoc($sql)) 151 151 $measurements[$row['fMeasurementTypeKey']] = $row; 152 152 … … 271 271 272 272 foreach ($queries as $query) 273 if (! mysql_query($query))274 die( mysql_error());275 276 mysql_close($db);273 if (!$db->query($query)) 274 die($sql->error); 275 276 $db->close(); 277 277 278 278 ?>
Note:
See TracChangeset
for help on using the changeset viewer.