function inspectDatabase() { $tableName = displayForm(); if (isset($tableName) && strlen($tableName) > 0) { $table = pullRecords1($tableName); printTable($table); } }
function printModelInfo($table, $source, $relationships, $columns) { echo '<h2>Model Info</h2>'; printTable($table); printSource($source); printRelationships($relationships); printColumns($columns); }
function printBallPopularity($orderBy, $showTop) { $conn = connectToDatabase(); $query = "SELECT roll.Ball_ID, Count(roll.Ball_ID) as numOfRolls, ball.Color, ball.Weight, ball.Size\n FROM roll, ball\n WHERE roll.Ball_ID = ball.Ball_ID\n GROUP by Ball_ID\n ORDER BY COUNT(Ball_ID) {$orderBy} LIMIT {$showTop}"; $result = $conn->query($query); printTable($result); $conn->close(); }
function showSchedule($array, $month, $teamName) { /*$exists = FALSE; foreach($array as $value) { if($month!= 'NULL') if($teamName !== 'NULL') if($value['Visitor'] == $teamName || $value['Home'] == $teamName) $exists = TRUE; else { } else $exists = TRUE; } if($exists == TRUE) {*/ echo '<table class = "table" style = "text-align:center; margin: 0 auto;" border="1">'; echo '<tr>'; echo "<td>Date</td>"; echo "<td>Logo</td>"; echo "<td>Visitor</td>"; echo "<td>PTS Away</td>"; echo "<td>Logo</td>"; echo "<td>Home</td>"; echo "<td>PTS Home</td>"; foreach ($array as $value) { if ($month != 'NULL') { if (strpos($value['Date'], $month) !== False) { if ($teamName !== 'NULL') { if ($value['Visitor'] == $teamName) { printTable($value); } else { if ($value['Home'] == $teamName) { printTable($value); } } } else { if (strpos($value['Visitor'], $month) !== False) { } else { printTable($value); } } } } else { if ($value['Visitor'] == $teamName) { printTable($value); } else { if ($value['Home'] == $teamName) { printTable($value); } } } } echo '</table>'; //} }
printTable($query, $prevparam, $nextparam, $search); } else { if ($request == "BAND") { $id = $_GET['i']; $prev = $start - $sizelimit; if ($prev < 0) { $prev = 0; } $prevparam = "r={$request}&i={$id}&s={$prev}"; $next = $start + $sizelimit; $nextparam = "r={$request}&i={$id}&s={$next}"; $query = $basequery . "WHERE v.BandID = {$id} AND v.Approved = 1 ORDER BY BandYear DESC"; $result = mysql_query($query); $row = mysql_fetch_array($result); $search = $row['School']; printTable($query, $prevparam, $nextparam, $search); } } } } } // Prints the actual interface for the user. // @Input $query - The SQL query to get the list of Videos to display. Must return // BandID, School, VideoURL, Title, Name, BandYear, and FestivalID // @Input $prevparam - The GET parameter for the 'Previous Page' link. Specific to the query type // @Input $nextparam - The GET parameter for the 'Next Page' link. Specific to the query type // @Input $search - What terms were searched for. Specific to the query type. function printTable($query, $prevparam, $nextparam, $search) { global $start, $sizelimit; require "../connection.inc.php";
$boardCells = explode('-', $boardRow); if (count($boardCells) != 8) { invalidBoard(); } foreach ($boardCells as $piece) { if (strpos("RHBKQP ", $piece) === false) { invalidBoard(); } if (empty($piecesCount[$piece])) { $piecesCount[$piece] = 0; } $piecesCount[$piece]++; } $board[] = $boardCells; } printTable($board); $pieceMapping = ['B' => "Bishop", 'H' => "Horseman", 'K' => "King", 'P' => "Pawn", 'Q' => "Queen", 'R' => "Rook"]; $piecesForPrint = []; foreach ($pieceMapping as $pieceLetter => $pieceName) { if (isset($piecesCount[$pieceLetter])) { $piecesForPrint[$pieceName] = $piecesCount[$pieceLetter]; } } echo json_encode($piecesForPrint); function printTable($matrix) { echo '<table>'; for ($row = 0; $row < count($matrix); $row++) { echo '<tr>'; for ($col = 0; $col < count($matrix[$row]); $col++) { echo '<td>' . htmlspecialchars($matrix[$row][$col]) . '</td>';
<? $filesArray = getFiles(); // SORT according to links... if ($_GET['sort'] == 'size'){ echo "sort by size"; /* usort($filesArray, function($a,$b){ if($a["size"] == $b["size"]) { return 0; } return ($a["size"] < $b["size"]) ? -1 : 1; }*/ } printTable($filesArray); function getFiles(){ $dirname = 'uploads/'; $dir = 'uploads/*'; $files = array(); $finfo = finfo_open(FILEINFO_MIME_TYPE); foreach (glob($dir) as $file){ $t = date("M j, Y g:i a", filemtime($file)); $m = finfo_file($finfo, $file); $m = getMime($m); $s = filesize($file); $n = basename($file); $href = "$dirname$n"; echo $s; $files[] = array("href"=>$href,"name"=>$n, "size"=>$s, "mime"=>$m, "time"=>$t);
<?php $input = json_decode($_GET['jsonTable']); //$input = [["god","save","the","queen"],[7,2]]; $maxCols = 0; //var_dump($input); //Uncomment this to see the input foreach ($input[0] as $key => $line) { $input[0][$key] = AffineEncrypt($line, $input[1][0], $input[1][1]); $maxCols = max(strlen($line), $maxCols); } printTable($input, $maxCols); function AffineEncrypt($plainText, $k, $s) { $cipherText = ""; // Put Plain Text (all capitals) into Character Array $chars = str_split(strtoupper($plainText)); // Compute e(x) = (kx + s)(mod m) for every character in the Plain Text foreach ($chars as $c) { $x = ord($c) - 65; if ($x < 0) { $cipherText .= $c; } else { $cipherText .= chr(($k * $x + $s) % 26 + 65); } } return $cipherText; } function printTable($input, $maxCol) { echo "<table border='1' cellpadding='5'>"; foreach ($input[0] as $key => $value) {
} ?> <body> <?php require "../connectionStrings.php"; // create connection $connection = pg_connect($pgConnectStr1); if (!$connection) { echo "Couldn't make a connection!"; exit; } // test connection if (!$connection) { echo "Couldn't make a connection!"; exit; } // create SQL statement $sql = "select * from xmipp_users order by my_date"; // execute SQL query and get result //$sql_result = pg_exec($connection,$sql); if (!($result = pg_query($sql))) { print "Query could not be executed.\n"; } $r = printTable($result); pg_close($connection); ?> </body>
function printTable($data, $fields, $row_classes, $cat, $child = 0) { foreach ($data as $count => $row) { ?> <tr class=" ds-list-item-new level-<?php print $child; ?> <?php /* print ($child == 0?'ds-list-item-new':''); */ ?> "> <?php printRow($row, $fields, $cat, $child + 1); if (!empty($row['child'])) { ?> </tr> <?php printTable($row['child'], $fields, $row_classes, $cat, $child + 1); } else { ?> </tr> <?php } } }
print "</mrow>\n\n"; } while ($row = pg_fetch_assoc($result)); print "</wholething>"; return true; //close out the table: } // create connection require "../connectionStrings.php"; $connection = pg_connect($pgConnectStr1); if (!$connection) { echo "Couldn't make a connection!"; exit; } // test connection if (!$connection) { echo "Couldn't make a connection!"; exit; } // create SQL statement $sql = "select * from xmipp_users order by my_date limit 3"; // execute SQL query and get result //$sql_result = pg_exec($connection,$sql); if (!($result = pg_query($sql))) { print "Query could not be executed.\n"; } $Nrows = pg_num_rows($result); $r = printTable($result, $Nrows); pg_close($connection); ?>
function printTable($data, $fields, $row_classes, $cat, $child = 0) { foreach ($data as $count => $row) { ?> <tr class="<?php print implode(' ', $row_classes[$count]); ?> ds-list-item-new level-<?php print $child; ?> " > <?php printRow($row, $fields, $cat, $child + 1); ?> </tr> <?php if (!empty($row['child'])) { printTable($row['child'], $fields, $row_classes, $cat, $child + 1); } } }
function generateXML() { global $keywords, $from, $to, $condition, $seller, $buyingFormats, $handlingTime, $sortBy, $resultsPerPage, $url, $xml; $length = 0; $i = 0; $keyword = ""; if (isset($_GET["search"])) { $keywords = $_GET["keywords"]; $keyword = urlencode($keywords); $string = "&keywords=" . $keyword; if (isset($_GET["from"]) && $_GET["from"] != "") { $from = $_GET["from"]; append($string, $i, "MinPrice", $from, 0); } if (isset($_GET["to"]) && $_GET["to"] != "") { $to = $_GET["to"]; append($string, $i, "MaxPrice", $to, 0); } if (isset($_GET["condition"])) { $condition = $_GET["condition"]; $length = count($condition); append($string, $i, "Condition", $condition, $length); } if (isset($_GET["buyingFormats"])) { $buyingFormats = $_GET["buyingFormats"]; $length = count($buyingFormats); append($string, $i, "ListingType", $buyingFormats, $length); } if (isset($_GET["returnAccepted"])) { append($string, $i, "ReturnsAcceptedOnly", "true", 0); } if (isset($_GET["freeShipping"])) { append($string, $i, "FreeShippingOnly", "true", 0); } if (isset($_GET["expeditedShipping"])) { append($string, $i, "ExpeditedShippingType", "Expedited", 0); } if (isset($_GET["handlingTime"]) && $_GET["handlingTime"] != "") { $handlingTime = $_GET["handlingTime"]; append($string, $i, "MaxHandlingTime", $handlingTime, 0); } $sortBy = $_GET["sortBy"]; $string .= "&sortOrder=" . $sortBy; $resultsPerPage = $_GET["resultsPerPage"]; $string .= "&paginationInput.entriesPerPage=" . $resultsPerPage; $url .= $string; $xml = simplexml_load_file($url); //print_r($xml); printTable(); } }
</div> <div class="content"> <h1>Ingredients</h1> <form action="addIngredient.php"> <button type="submit">Add Ingredient</button> </form> <br> <form action="ingredients.php" method="post"> <input type="text" name="searchInput"> <button type="submit">SEARCH INGREDIENTS</button> </form> <br> <?php require_once 'functions.php'; $db = (require "../php/loadDB.php"); $notSearched = true; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $searchValue = $_POST["searchInput"]; $query = "SELECT * FROM ingredients WHERE name = \"{$searchValue}\""; $notSearched = false; } else { $query = "SELECT * FROM ingredients"; } printTable($db->query($query), "name", "unit_measure", $notSearched); ?> </div> </body> </html>
// Get the table header if (get_class($data) == "TE") { $thead = $tableTE; } elseif (get_class($data) == "PP") { $thead = $tablePP; } $user = new User($review->user); // Get the table data if (get_class($data) == "TE") { $tdata[] = array(1 => $user->real_name, 2 => $data->s1, 3 => $data->s2, 4 => $data->s3, 5 => $data->s4, 6 => $data->s6); } elseif (get_class($data) == "PP") { $tdata[] = array(1 => $user->real_name, 2 => $data->s1, 3 => $data->s2, 4 => $data->s3, 5 => $data->s4); } } // Print table printTable($thead, $tdata); // Print comments $comments = $submission->getComments(); echo "<br><br>"; echo "Student comment: "; if (isset($comments[0])) { echo $comments[0]->data; } echo "<br>Uploaded files: "; echo "<br><br>"; //TODO Name of uploaded files regarding this submission foreach ($submission->getReview() as $key => $value) { // Get the review $id = $submission->getLatestReview($key); $review = $submission->getReview($id); echo "<br>Overall comments and feedback: " . $review->data->feedback;
public function printTable($ladderkey) { printTable($this->connector->getStats($ladderkey)); return 1; }
<script src="https://gist.github.com/viion/8e419153efe929c1216e.js"></script> <!-- Variables --> <div class="docline"></div> <h4>Variables</h4> <table class="doctable" cellspacing="0" cellpadding="0" border="0"> <tr class="header"> <td>parameter</td> <td>type</td> <td>description</td> </tr> <?php $table = [['AchievementCategories', 'array', 'Array containing a list of achievement categories.'], ['ClassList', 'array', '...'], ['ClassDisicpline', 'array', '...'], ['GearSlots', 'array', 'Array containing gear slots (as strings),'], ['Characters', 'array', 'Array containing Character objects for any characters searched.'], ['Achievements', 'array', 'Array containing character achievements, the list datatype is Achievement object'], ['Search', 'array', 'Array containing the results of any current search'], ['FreeCompanyList', 'array', 'Array containing Freecompany objects for any FCs searched.'], ['FreeCompanyMembersList', 'array', 'Array containing characters to an FC.'], ['Linkshells', 'array', 'Array containing Linkshell objects for any LSs searched.']]; printTable($table); ?> </table> <!-- Functions --> <div class="docline"></div> <h4>Functions</h4> <table class="doctable" cellspacing="0" cellpadding="0" border="0"> <tr class="header"> <td>function</td> <td>return</td> <td>description / code gist</td> </tr> <?php $table = [['__construct()', '-', '...'], 'Quick Functions <span style="opacity:0.5;">*recommended</span>', ['get()', '(object) Character', 'Get a Character object. Pass in an array containing either Name/Server OR id. <script src="https://gist.github.com/viion/ee039dffea7d43b59e1a.js"></script>'], ['getFC()', '(object) FreeCompany', 'Get a FreeCompany object. Pass in an array containing either Name/Server OR id. An $Options param can be parsed to state whether to fetch members or not. <script src="https://gist.github.com/viion/a3c884a133b408b88a3a.js"></script>'], ['getLS()', '(object) Linkshell', 'Get a Linkshell object. Pass in an array containing either Name/Server OR id. <script src="https://gist.github.com/viion/b6152fe131d12a84d865.js"></script>'], 'Access Functions', ['Lodestone()', '(object) Lodestone', 'Get access to the Lodestone class, for parsing specific stuff off the Lodestone Website. <script src="https://gist.github.com/viion/be3d73d69e687f1bd9b3.js"></script>'], ['Social()', '(object) Social', 'Get access to the Social class, for parsing Twitter and Youtube. <script src="https://gist.github.com/viion/78cf75b00a8853ba98a0.js"></script>'], 'Search', ['searchCharacter()', '(object) Character', 'Search a Character. <script src="https://gist.github.com/viion/44113b3a20e4f6a1a27b.js"></script>'], ['searchFreeCompany()', '(object) Freecompany', 'Search a Free Company. <script src="https://gist.github.com/viion/a5cf91ff0f94c78d69e0.js"></script>'], ['searchLinkshell()', '(object) Linkshell', 'Search a Linkshell. <script src="https://gist.github.com/viion/bf5f4b7e531bb91bcbac.js"></script>'], 'Search return', ['getSearch()', 'array', 'Get an array containing the latest search results. This is used in the previous 3 search<Type>() code examples above.'], ['errorPage()', 'boolean', 'This function is not recommended, a simple conditional check is more practical and readable: <script src="https://gist.github.com/viion/bccd377ac077cf43cd83.js"></script>'], 'Character', ['parseProfile()', '-', 'Parse a characters profile via their lodestone ID. <script src="https://gist.github.com/viion/0ebcca0c48b89f584ab6.js"></script>'], ['parseBiography()', '-', 'Parse a characters biography via their lodestone ID. <script src="https://gist.github.com/viion/c8611e5d9e56cbd5811a.js"></script>'], ['getCharacters()', 'array of (object) Character', 'Get an array containing Character objects for all parsed Characters.'], ['getCharacterByID()', '(object) Character', 'Get a Character object via its ID.'], 'Achievements', ['parseAchievements()', '-', 'Parse a characters achievements via their lodestone ID'], ['parseAchievementsByCategory()', '-', 'Parse an achievements catagory of a character via their lodestone ID'], ['getAchievements()', 'array of (object) Achievement', 'Get an array containing Character objects for all parsed Characters.'], ['getAchievementCategories()', '(object) Achievement', 'Get a list of achievement categories (an array of strings)'], 'FreeCompany', ['parseFreeCompany()', '-', 'Parse a FreeCompany via its lodestone ID'], ['getFreeCompanies()', 'array of (object) FreeCompany', 'Gets an array containing FreeCompany objects for all parsed Free Companies.'], ['getFreeCompanyByID()', '(object) FreeCompany', 'Gets a FreeCompany object via its ID.'], 'Linkshell', ['parseLinkshell()', '-', 'Parse a Linkshell via its lodestone ID'], ['getLinkshells()', 'array of (object) Linkshell', 'Gets an array containing Linkshell objects for all parsed Linkshells.'], ['getLinkshellByID()', '(object) Linkshell', 'Gets a Linkshell object via its ID.']]; printTable($table); ?> </table>
function minpp() { $min = executePlainSQL("SELECT * FROM moves m1 WHERE m1.pp <= ALL (SELECT m2.pp FROM MOVES m2)"); printTable($min); }
function nzbmatrix($item, $nzbusername, $nzbapi, $saburl, $sabapikey) { $type = !empty($_GET['type']) ? "&catid=" . $_GET['type'] : ""; $search = "https://api.nzbmatrix.com/v1.1/search.php?search=" . urlencode($item) . $type . "&num=50&username="******"&apikey=" . $nzbapi; $content = file_get_contents($search); $itemArray = explode('|', $content); $table = ""; if ($itemArray["0"] != 'error:nothing_found') { foreach ($itemArray as &$x) { $item = explode(';', $x); if (isset($item[1])) { $id = "ID: " . substr($item[0], 6); $name = substr($item[1], 9); $link = "http://www." . substr($item[2], 6); $size = 0 + substr($item[3], 6); $size = $size; $cat = substr($item[6], 10); $addToSab = $saburl . "api?mode=addurl&name=http://www." . substr($link, 6) . "&nzbname=" . urlencode($name) . "&output=json&apikey=" . $sabapikey; $indexdate = "Index Date: " . substr($item[4], 12); $group = "Group: " . substr($item[7], 7); $comments = "Comments: " . substr($item[8], 10); $hits = "Hits: " . substr($item[9], 6); $nfo = "NFO: " . substr($item[10], 5); $weblink = substr($item[11], 9); $image = substr($item[13], 7); $item_desc = "<p>Name: " . $name . "</p><p>" . $id . "</p><p>" . $group . "</p><p>" . $comments . "</p><p>" . $hits . "</p><p>" . $nfo . "</p><p>" . $indexdate . "</p>"; $addToSab = addCategory($cat, $addToSab); if (strlen($name) != 0) { $table .= printTable($name, $cat, $size, $addToSab, $link, $item_desc, $image, $weblink); } } } } return $table; }
<?php $input = json_decode($_GET['jsonTable']); list($minRow, $minCol, $maxRow, $maxCol) = findLargestRectangularArea($input); printTable($input, $minRow, $minCol, $maxRow, $maxCol); function findLargestRectangularArea($input) { $maxArea = 0; $result = false; for ($minRow = 0; $minRow < count($input); $minRow++) { for ($maxRow = $minRow; $maxRow < count($input); $maxRow++) { for ($minCol = 0; $minCol < count($input[$minRow]); $minCol++) { for ($maxCol = $minCol; $maxCol < count($input[$minRow]); $maxCol++) { if (isRectangle($input, $minRow, $minCol, $maxRow, $maxCol)) { $area = ($maxRow - $minRow + 1) * ($maxCol - $minCol + 1); if ($area > $maxArea) { $maxArea = $area; $result = [$minRow, $minCol, $maxRow, $maxCol]; } } } } } } return $result; } function isRectangle($input, $minRow, $minCol, $maxRow, $maxCol) { $value = $input[$minRow][$minCol]; for ($col = $minCol; $col <= $maxCol; $col++) { if ($input[$minRow][$col] != $value) {
break; case "Set On": $fullURL = $baseURL . '/gpio/1'; break; case "Set Off": $fullURL = $baseURL . '/gpio/0'; break; } } else { die('Something not right!'); } } else { die('Password is wrong!'); } } printTable($conn, getTable($conn)); ?> <div> Add Query to Schedule: <form id="addQuery" action="dude.php" method="POST"> <input type="hidden" name="Command" value="Add"> Name:<input list="names" name="myName" value="Amir"> <datalist id="names"> <option value="Amir"> <option value="Batia"> </datalist> <br> Repeat:<input list="toRepeat" name="myRepeat" value="Once"> <datalist id="toRepeat"> <option value="Once"> <option value="Daily"> </datalist> <br> Starting Date: :<input type="date" name="startDate" value="<?php
$footballColumn[3] += 1; } else { $footballColumn[2] += 1; } } $newtxt = $sportsColumn[0] . "\n" . $sportsColumn[1] . "\n" . $sportsColumn[2] . "\n" . $sportsColumn[3] . "\n" . $footballColumn[0] . "\n" . $footballColumn[1] . "\n" . $footballColumn[2] . "\n" . $footballColumn[3] . "\n"; //echo "TEST: <br>" . $newtxt; $newFile = fopen("results.txt", "w"); fwrite($newFile, $newtxt); fclose($newFile); printTable($sportsColumn, $footballColumn); $_SESSION["survey"] = "taken"; } else { if (isset($_SESSION["survey"])) { readColumns(); printTable($sportsColumn, $footballColumn); } else { echo "Take the Survey You Haven't Taken It Yet!!"; } } //$_SESSION["survey"] = "done"; //echo "test" . $_SESSION["survey"]; function readColumns() { $resultFile = fopen("results.txt", "r"); global $sportsColumn, $footballColumn; for ($i = 0; $i < 4; $i++) { $sportsColumn[$i] = fgets($resultFile); $sportsColumn[$i] = str_replace("\n", "", $sportsColumn[$i]); } for ($i = 0; $i < 4; $i++) {
<div class="form-group"> <label for="inputMatric">Matric Number</label> <input type="text" class="form-control" id="inputMatric" name="matric"> </div> <div class="form-group"> <label for="inputModuleCode">Module Code</label> <input type="text" class="form-control" id="inputModuleCode" name="mcode"> </div> <div class="form-group"> <label for="inputGrade">Grade</label> <input type="text" class="form-control" id="inputGrade" name="grade"> </div> <input type="submit" class="btn btn-primary" name="show" value="Show"> <button type="submit" class="btn btn-primary" name="submit">Submit</button> </form> </div> </div> <div class="table"> <div = class="container"> <?php printTable(); ?> </div> </div> <!-- Latest compiled and minified JavaScript --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> </body> </html>
try { query($query); echo "<h4>participante cadastrado!</h4>"; } catch (Exception $e) { // echo "<pre>"; // print_r($e); // echo "</pre>"; switch ($e->getCode()) { case '1062': $evento = mysqli_fetch_assoc(query("SELECT eid,enome FROM evento WHERE eid='" . $participante['eid'] . "'")); echo "<p>Participante já cadastrado no evento " . $evento['enome'] . "!</p>"; break; } } $query = "SELECT ev.enome as 'Evento', pe.pcpf as 'CPF', pe.pnome as 'Nome', pe.pnasc as 'Data de Nascimento', pt.ptipo as 'Tipo', pe.email as 'E-mail'\n\t\t\t\tFROM participante pt\n\t\t\t\tLEFT JOIN evento ev\n\t\t\t\t\tON pt.eid = ev.eid\n\t\t\t\tLEFT JOIN pessoa pe\n\t\t\t\t\tON pt.pcpf = pe.pcpf\n\t\t\t\tWHERE pt.pcpf = '" . $pessoa['pcpf'] . "'\n\t\t\t\tORDER BY pe.pnome"; printTable(query($query)); } if (isset($_GET['evento'])) { $query = "SELECT eid,enome FROM evento ORDER by 1"; $result = query($query); $array = array(); array_push($array, array('id' => '', 'text' => 'Selecione...')); while ($row = mysqli_fetch_assoc($result)) { array_push($array, array('id' => $row['eid'], 'text' => $row['enome'])); } echo json_encode($array); } if (isset($_GET['pessoa'])) { $pcpf = $_GET['pessoa']; $query = "SELECT * FROM pessoa WHERE pcpf='{$pcpf}' ORDER by 1"; $result = query($query);
function printResults($name, $cols, $data) { $attributes = array(); while ($row = OCI_Fetch_Array($cols, OCI_NUM)) { $attributes[] = $row[0]; } echo "<br>INSERT NEW<br>(enter value for each attribute)"; printInsertFields($name, $attributes); echo "<br>UPDATE<br>(search for the row to change, then choose attribute to change and enter new value)<br>"; printUpdateFields($name, $attributes); echo "<br>DELETE<br>(search for the row to delete)<br>"; printDeleteFields($name, $attributes); echo "<br>DATA FROM TABLE " . $name . "<br>"; printTable($attributes, $data); }
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Table</title> </head> <body> <?php //Write a PHP script information_table.php which creates a table from given information about a person (name, phone number, age, address). Styling the table is optional. Semantic HTML is required. function printTable($name, $phone, $age, $address) { echo '<table><tbody>' . '<tr><td>Name</td><td>' . $name . '</td></tr>' . '<tr><td>Phone number</td><td>' . $phone . '</td></tr>' . '<tr><td>Age</td><td>' . $age . '</td></tr>' . '<tr><td>Address</td><td>' . $address . '</td></tr>' . '</tbody></table>' . '<style> table td{ border:1px solid black; } table{ border-collapse:collapse; } table td:nth-child(odd){ background-color:orange; } table td:nth-child(even){ text-align:right; } </style>' . '<br>'; } printTable('Gosho', '0882-321-423', 24, 'Hadji Dimitar'); printTable('Pesho', '0884-888-888', 67, 'Suhata Reka'); ?> </body> </html>
<input type="radio" name="action" value="SortDate" /> Date </div> <div class="form-group"> <input type="radio" name="action" value="SortID" /> User ID </div> <div class="form-group"> <input type="radio" name="action" value="SortTitle" /> Event Title </div> <div class="form-group"> <input type="submit" value="Sort Events" class="btn btn-primary" /> </div> <div class="form-group"> <input type="checkbox" id="showHideCheckbox" onclick="showHideNewEventForm()" <?php echo $editInProgress; ?> > Add New Event <!-- Php variable will give attribute "checked" if an edit is in progress --> </div> </form> </div> <div class="col-sm-8"><!-- Event calendar filled here --> <h2>Calendar Events</h2> <?php printTable($eventsArray, $keys); ?> </div> </div><!-- End page content --> </div><!-- End of main container --> </body> </html>
function net2ftp_module_printBody() { // -------------- // This function prints the login screen // -------------- // ------------------------------------------------------------------------- // Global variables // ------------------------------------------------------------------------- global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result; if (isset($_POST["input_admin_username"]) == true) { $input_admin_username = htmlEncode2(validateGenericInput($_POST["input_admin_username"])); } else { $input_admin_username = ""; } if (isset($_POST["input_admin_password"]) == true) { $input_admin_password = htmlEncode2(validateGenericInput($_POST["input_admin_password"])); } else { $input_admin_password = ""; } if (isset($_POST["datefrom"]) == true) { $datefrom = addslashes(validateGenericInput($_POST["datefrom"])); } else { $datefrom = ""; } if (isset($_POST["dateto"]) == true) { $dateto = addslashes(validateGenericInput($_POST["dateto"])); } else { $dateto = ""; } // ------------------------------------------------------------------------- // Variables for all screens // ------------------------------------------------------------------------- // Output variable $net2ftp_output["admin_viewlogs"][] = ""; // Title $title = __("Admin functions"); // Form name, back and forward buttons $formname = "AdminForm"; $back_onclick = "document.forms['" . $formname . "'].state.value='admin';document.forms['" . $formname . "'].submit();"; $forward_onclick = "document.forms['" . $formname . "'].submit();"; // ------------------------------------------------------------------------- // Variables for screen 1 // ------------------------------------------------------------------------- // ------------------------------------ // Connect to the database // ------------------------------------ $mydb = connect2db(); if ($net2ftp_result["success"] == false) { return false; } // ------------------------------------ // Execute the SQL query and print the data // ------------------------------------ // Query 1 $sqlquery1 = "SELECT * FROM net2ftp_log_access WHERE date BETWEEN '{$datefrom}' AND '{$dateto}' ORDER BY date DESC, time DESC;"; $table1 = printTable($sqlquery1); if ($net2ftp_result["success"] == false) { return false; } // Query 2 $sqlquery2 = "SELECT * FROM net2ftp_log_error WHERE date BETWEEN '{$datefrom}' AND '{$dateto}' ORDER BY date DESC, time DESC;"; $table2 = printTable($sqlquery2); if ($net2ftp_result["success"] == false) { return false; } // Query 3 $sqlquery3 = "SELECT * FROM net2ftp_log_consumption_ftpserver WHERE date BETWEEN '{$datefrom}' AND '{$dateto}' ORDER BY datatransfer DESC, date DESC;"; $table3 = printTable($sqlquery3); if ($net2ftp_result["success"] == false) { return false; } // Query 4 $sqlquery4 = "SELECT * FROM net2ftp_log_consumption_ipaddress WHERE date BETWEEN '{$datefrom}' AND '{$dateto}' ORDER BY datatransfer DESC, date DESC;"; $table4 = printTable($sqlquery4); if ($net2ftp_result["success"] == false) { return false; } // ------------------------------------------------------------------------- // Print the output // ------------------------------------------------------------------------- require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php"; }
<?php $input = json_decode($_GET['jsonTable']); $colSize = $input[0]; $message = ""; foreach ($input[1] as $key => $value) { preg_match_all('/(?<=time=)\\d{1,3}(?=ms)/', $value, $matches); //var_dump($matches); if (isset($matches[0][0])) { $message .= chr($matches[0][0]); } } $words = explode("*", $message); printTable($words, $colSize); function printTable($input, $colSize) { echo "<table border='1' cellpadding='5'>"; foreach ($input as $key => $value) { printWord($value, $colSize); } echo "</table>"; } function printWord($word, $colSize) { $rows = ceil(strlen($word) / $colSize); $currentChar = 0; for ($i = 0; $i < $rows; $i++) { echo "<tr>"; for ($j = 0; $j < $colSize; $j++) { if ($currentChar < strlen($word) && $word[$currentChar] != ' ') { echo "<td style='background:#CAF'>";
if (array_key_exists('dostuff', $_POST)) { // Insert data into table... echo "<br>inserting sample data into db...<br>"; runSQLScript('sql/sample.sql'); } } printTable('users'); printTable('image'); printTable('match'); printTable('successfulMatch'); printTable('unsuccessfulMatch'); printTable('message'); printTable('business'); printTable('interest'); printTable('scheduledTimes'); printTable('interestedIn'); printTable('activity'); /* Commit to save changes... */ OCICommit($db_conn); /* LOG OFF WHEN YOU'RE DONE! */ OCILogoff($db_conn); } else { /* if ($db_conn) */ echo "cannot connect"; $e = OCI_Error(); // For OCILogon errors pass no handle echo htmlentities($e['message']); } ?> </body>