Basic PHP Demo

The code below is to help you get started. Copy it into a file named 'hello.php' in the public_html subdirectory of your home directory. The URL to this will be http://student.athabascau.ca/~login/hello.php (replace login with your server login name.)

<?php
Print "Hello, World!";
?>

You should see the same results as in this link:
http://student.athabascau.ca/~db/hello.php


MySQL PHP Database Connect Demo

You will first need to contact the SCIS technical team to request to have a MySQL database created for you.

Once you have the database login information, copy the code below into a file named 'mysql.php' in your public_html directory. Replace the following with the username, password, and database name you were supplied with for the MySQL database. (This is not the same as your server login information.):
$username = "dblogin";
$password = "xxxxx";
$database = "dbname";

The URL to this will be http://student.athabascau.ca/~login/mysql.php (replace login with your server login name.)

<?php
$username = "dblogin";
$password = "xxxxx";
$database = "dbname";
$hostname = "localhost";
$dbh = mysql_connect($hostname, $username, $password)
        or die("Unable to connect to MySQL");
$selected = mysql_select_db($database,$dbh)
        or die("Could not select database $database");
print "Connected to MySQL database $database";
mysql_close($dbh);
?>

You should see the same results as in this link:
http://student.athabascau.ca/~testdb/mysql.php