"; $colnames = $queryres -> getColumnNames(); print "
";
return $db;
}
// try again with mysql
$dataSourceName['phptype'] = 'mysql';
$db = MDB2::connect($dataSourceName, $options);
if (! MDB2::isError($db)) { return $db; }
die("cannot connect: " . $db->getMessage());
}
function connect2() {
$user= 'pld';
$password='blue';
$database='office';
$phptype ='mysqli'; // use 'mysql' on lamp.cslabs.luc.edu
$dataSourceName = array(
'phptype' => $phptype,
'username'=> $user,
'password'=> $password,
'hostspec'=> 'localhost',
'database'=> $database
);
$options = array('debug'=>2);
// $dbc = mysqli_connect("localhost", "mye", "p22222", "mye")
//$db=MDB2::connect("mysqli://$user:$password@localhost/$database");
$db = MDB2::connect($dataSourceName, $options);
if (MDB2::isError($db)) {
die("cannot connect: " . $db->getMessage());
}
return $db;
}
/*
* old version of connect()
*/
function connect_old() {
$user='pld';
$password='blue';
$database="office";
$db=MDB2::connect("mysqli://$user:$password@localhost/$database");
if (MDB2::isError($db)) {
die("cannot connect: " . $db->getMessage());
}
return $db;
}
/*
* $menuname is the name given to the menu itself, that will be used to retrieve
* the selected value from $_POST.
* $names is an array of strings like ['foo', 'bar', 'quux'], these are used
* as the menu choices (both name and value)
*/
function makeSelectMenu($menuname, $names) {
print "";
}
function makePageButtons () {
print <<
END;
}
?>