"; $colnames = $queryres -> getColumnNames(); print ""; foreach ($colnames as $colname => $colnum) { print ""; print $colname; print ""; } print "\n"; while ($row = $queryres -> fetchRow(MDB2_FETCHMODE_ORDERED)) { print ""; $j=0; while ($j < count($row)) { print ""; if ($row[$j] == NULL) print $nullval; else print htmlspecialchars($row[$j]); $j++; print ""; } print "\n"; } print "\n"; } /* * to connect, replace the user/password/database args with your own!!! */ function connect() { $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); $db = MDB2::connect($dataSourceName, $options); if (! MDB2::isError($db)) { print "connect succeeded with driver $phptype

"; 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; } ?>