コード例 #1
0
$object = new Objects();
$db = new database();
$db->login();
// Add a column club to the observer
$sql = "ALTER TABLE observers ADD club varchar(20) NOT NULL default ''";
$run = mysql_query($sql) or die(mysql_error());
// Add a column stdatlas to the observer
$sql = "ALTER TABLE observers ADD stdatlas int(3) NOT NULL default '0'";
$run = mysql_query($sql) or die(mysql_error());
// Correct the uranometriapages
$sql = "SELECT * FROM objects";
$run = mysql_query($sql) or die(mysql_error());
while ($get = mysql_fetch_object($run)) {
    $ra = $get->ra;
    $dec = $get->decl;
    $urano = $object->calculateUranometriaPage($ra, $dec);
    $name = $get->name;
    $sql2 = "UPDATE objects SET urano = \"{$urano}\" WHERE name = \"{$name}\"";
    $run2 = mysql_query($sql2) or die(mysql_error());
}
// Remove some objects from the database
$sql = "DELETE FROM objects WHERE name=\"Eridanus Cluster\"";
mysql_query($sql) or die(mysql_error());
$sql = "UPDATE objects SET alternative_name = \"\" WHERE alternative_name = \"Hyades\"";
$run = mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM objects WHERE name=\"Coalsack\"";
mysql_query($sql) or die(mysql_error());
$sql = "UPDATE objects SET alternative_name = \"\" WHERE alternative_name = \"Small Magellanc Cl\"";
$run = mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM objects WHERE name=\"Lg Magellanic Cl\"";
mysql_query($sql) or die(mysql_error());