rowCount() . "
";
// print 'colcount=' . $queryres->columnCount() . "
";
$colcount = $queryres->columnCount();
$rowcount = $queryres->rowCount();
print "
"; print $colname; print " | \n"; } print "
---|
"; if ($row[$col] == NULL) print $nullval; else print ($row[$col]); $col++; print " | "; } print "
'; return $dbconn; } catch(PDOException $e) { echo $e->getMessage(); return null; } } /* * simple_query executes a simple prepared query. * In the event of failure it returns a string describing the error; * this can be identified using is_string(). * The PDOStatement object is returned if the query is successful. * One row of the return object is obtained by the $stmt->fetch() method */ function simple_query($db, $query, $queryargs) { $stmt = $db->prepare($query); if ($stmt == FALSE) { $errarray = $db->errorInfo(); // error would live in $db $errmsg = $errarray[2]; $error = "Prepare-statement error for query \"$query\": error is $errmsg"; return $error; } $ret = $stmt->execute($queryargs); // $stmt is the PDOStmt object if ($ret == FALSE) { print("execution of query not successful: \"$query\"
\n");
$errarray = $stmt->errorInfo();
$errmsg = $errarray[2];
$error = "query execution unsuccessful: \"$query\"; error is $errmsg";
return $error;
}
return $stmt;
}
/*
* $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 makeSelectMenuString($menuname, $names) {
$result = "\n";
return $result;
}
function makePageButtons () {
print <<
END;
}
?>