How-to details

When I opted to use a hosted website, I got PHP and MySQL support into the bargain. My first database usage was the very small airsick bag collection. The astronomy current usage is a step up. The linked page gives you access to a star catalogs containing nearly a million. The point? To see how this stuff works.

To test this stuff, I use xampp on a windows box which installs Apache Web Server, PHP, and MySQL. to develop, I am now using Ubuntu with lampp installed, VSCode for the main editor for writing HTML and PHP scripts, and git for revision control. The dbs are not in git. Using a nix for dev helps, as a lot of websites host on linux-alikes and developing in a case-sensitive world makes the posting to the website easier.

The following is a very early process. I tend to use Mysql workbench or phpadmin for importing db data. Lots of the data from hearsarc or strasbourg can be gotten in csv form, but might need to edit out a header, or make the db table prior to the import. Takes time and thoughtware, but is fun.


I downloaded from heasarc ftp://legacy.gsfc.nasa.gov/heasarc/dbase/dump/ the PPM catalog in an ASCII file, with a header describing the layout followed by a data section. I created the table ppm in my test database, using the description of the data layout in the header. I then loaded the file into wordpad and saved without the header, and then used the mysql command line command interpreter to load from local file to populate the table:

    mysql> load data local infile 'c:\temp\hearsarc_ppm.tdat' into table ppm fields delimited by '|';
    

I then wrote a couple of HTML link pages, this one from the main page and the longitude setting page that follows, and developed a PHP script to determine GMT (Greenwich Mean Time), GST (Greenwich Sidereal Time), and LST (local sidereal time, depends on longitude), and then display star records whose RA (right ascension) is close to current LST, within an arcminute of upper transit (local latitude determines the souternmost stars "visible").

I browsed a lot of the mySQL documentation and a few other places on the web to determine how to upload the local test.ppm table to the web-side database host. The following method works:

I used mysqldump to capture the table data into a create and insert script that is saved to a known place on the hard drive. A path can be specified.

    mysqldump test.ppm > test_ppm.sql
    

I then used mysql to upload the resulting file to the web.

    mysql --host=myhost --port=#### --user=myname -p mydatabasename < test_ppm.sql
    

The -p option specifies the command should ask for the user password. I entered the name, and then waited a very long time (some 8 hours) to upload the data.