<HTML> <BODY> <?php //mysql_connect("127.0.0.1:3306", "root", "madmax1.") or die(mysql_error()); //mysql_select_db("mydb") or die(mysql_error()); include "../common/functions.php"; db_utility::db_connect(); function getmaxprimarykey($tablename) { $select = 'select primary_key from ' . $tablename . ' order by primary_key DESC'; $results = mysql_query($select) or die("Failed Query of " . $select); $firstrow = mysql_fetch_array($results); return $firstrow['primary_key']; } function check_dataset_exists($dataset) { $select = 'select count(data_set) from job_info where data_set=\'' . $dataset . '\''; $results = mysql_query($select) or die("Failed Query of " . $select); $firstrow = mysql_fetch_array($results); if ($firstrow['count(data_set)'] > 0) { die("Data_set name already exists. Terminating."); } } function insertarrayintodb($array, $tablename) { $fields = ""; $values = ""; for ($i = 0; $i < sizeof($array); ++$i) { $val = $array[$i]['value']; if (!is_null($val) && !empty($val)) { if (!empty($fields)) {
<?php require_once '../common/functions.php'; db_utility::db_connect(); ?> <html> <body> <table border="10"> <?php $sql = "select * from job_queue "; $fields = array('id', 'start_time', 'task_id', 'status', 'priority', 'queued_time'); db_utility::maketable($sql, $fields); ?> </table> </body> </html>
//echo $query3."<BR>"; $result3 = mysql_query($query3) or die("Failed Query of " . $query3); echo "DELETED TEST VIEW...<BR>"; //now read to create new view with old name $result4 = mysql_query($viewcode) or die("Failed Query of " . $viewcode); echo "output: " . $result4; echo "<BR>SUCCESSFULLY CREATED NEW VIEW<BR>"; } ?> <form name="listviews" action="editview.php" method=POST> <table> <tr><td><select name="views" onchange="this.form.submit();"> <!-- <tr><td><select name="views" onclick="myalert();"> --> <?php $column_name = "Tables_in_" . db_utility::get_database(); echo "<option value=\"1\">--select a view--</option>"; for ($j = 0; $j < mysql_num_rows($result1); $j++) { $row1 = mysql_fetch_array($result1); echo "<option value=\"" . $row1[$column_name] . "\""; if (isset($_POST['views'])) { if ($row1[$column_name] == $_POST['views']) { echo "selected"; } } echo ">" . $row1[$column_name] . "</option>"; } ?> </select></td></td> <tr><td><input type="hidden" value="Submit" name="Submitform" /></td></tr> </form>
static function pageCounter() { $uri = $_SERVER['REQUEST_URI']; if (strpos($uri, '?') != false) { $uri = substr($uri, 0, strpos($uri, '?')); } db_utility::db_connect(); $query1 = "select hits from page_counters where uri='" . $uri . "'"; $result1 = mysql_query($query1) or die("Failed Query of " . $query1); $row1 = mysql_fetch_array($result1); if ($row1 == null) { $query2 = "insert into page_counters (uri,hits) values ('" . $uri . "',1)"; } else { $query2 = "update page_counters set hits=" . ($row1['hits'] + 1) . " where uri='" . $uri . "'"; } mysql_query($query2) or die("Failed Query of " . $query2); }
public static function setDatabase($db) { self::$functions_database = $db; }