Changeset 7546 for trunk/MagicSoft/Mars/datacenter/db/include.php
- Timestamp:
- 02/28/06 20:23:38 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/db/include.php
r7527 r7546 1 1 <?php 2 /*3 function PrintTable($table)4 {5 $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");6 if ($db_id==FALSE)7 {8 printf("mysql_connect returned the following error:<br>");9 printf("%s<br>", mysql_error());10 die("");11 }12 printf("%s<br>", $table);13 printf("<table BORDER=\"1\">");14 15 $query = "EXPLAIN ";16 $query .= $table;17 18 $result = mysql_query($query);19 $numrows = mysql_num_rows($result);20 $numcols = mysql_num_fields($result);21 printf("%d x %d<br>", $numrows, $numcols);22 23 printf("<tr>");24 for ($i=0; $i<$numrows; $i++)25 {26 $row = mysql_fetch_row($result);27 printf("<th>%s</th> ", $row[0]);28 }29 printf("</tr>");30 31 $query = "SELECT * FROM ";32 $query .= $table;33 34 $result = mysql_query($query);35 36 $numrows = mysql_num_rows($result);37 $numcols = mysql_num_fields($result);38 printf("%d x %d<br>", $numrows, $numcols);39 40 while ($row = mysql_fetch_row($result))41 {42 printf("<tr>");43 foreach ($row as $entry)44 {45 printf("<td>%s</td> ", $entry);46 }47 printf("</tr>");48 }49 printf("</table>");50 51 mysql_free_result($result);52 53 mysql_close($db_id);54 }55 */56 2 57 3 function EnumQuery($name) … … 193 139 } 194 140 195 function PrintPullDown($ db, $table, $name, $index, $descr)196 { 197 $db_id = mysql_connect( "hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");141 function PrintPullDown($host, $user, $pw, $db, $table, $name, $index, $descr) 142 { 143 $db_id = mysql_connect($host, $user, $pw); 198 144 if ($db_id==FALSE) 199 145 { … … 250 196 } 251 197 252 function GetMin($field, $table, $ db)253 { 254 $db_id = mysql_connect( "hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");198 function GetMin($field, $table, $host, $user, $pw, $db) 199 { 200 $db_id = mysql_connect($host, $user, $pw); 255 201 if ($db_id==FALSE) 256 202 { … … 275 221 } 276 222 277 function GetMax($field, $table, $ db)278 { 279 $db_id = mysql_connect( "hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");223 function GetMax($field, $table, $host, $user, $pw, $db) 224 { 225 $db_id = mysql_connect($host, $user, $pw); 280 226 if ($db_id==FALSE) 281 227 { … … 299 245 return $max; 300 246 } 301 /*302 function GetMin()303 {304 $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");305 if ($db_id==FALSE)306 {307 printf("mysql_connect returned the following error:<br>");308 printf("%s<br>", mysql_error());309 die("");310 }311 312 $query = "SELECT MIN(fRunNumber) FROM MyMagic.RunData";313 $result = mysql_query($query);314 if (!$result)315 return "0";316 317 $row = mysql_fetch_row($result);318 319 $min = $row[0];320 321 mysql_free_result($result);322 mysql_close($db_id);323 324 return $min;325 }326 327 function GetMax()328 {329 $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");330 if ($db_id==FALSE)331 {332 printf("mysql_connect returned the following error:<br>");333 printf("%s<br>", mysql_error());334 die("");335 }336 337 $query = "SELECT MAX(fRunNumber) FROM MyMagic.RunData";338 $result = mysql_query($query);339 if (!$result)340 return "0";341 342 $row = mysql_fetch_row($result);343 344 $max = $row[0];345 346 mysql_free_result($result);347 mysql_close($db_id);348 349 return $max;350 }351 */352 247 353 248 function PrintText($result0)
Note:
See TracChangeset
for help on using the changeset viewer.