public function showStep2($step, $sql) { $tableName[] = $this->getListOfTables(); $numOfSteps = $this->getTotalSteps(); $thisStep = $step; if ($numOfSteps > 1) { $thisNumStep = $numOfSteps - count($tableName[0]); } else { $thisNumStep = $numOfSteps; } if ($step <= count($tableName[0]) && $numOfSteps > 1) { $step = count($tableName[0]) + 1; $thisStep = 1; } else { if ($step > count($tableName[0])) { $thisStep = $step - count($tableName[0]); } } $query = "SELECT * FROM " . $tableName[0][0]; $con = mysqli_connect(DB_SERVER, DECOMPOSE_USER, DECOMPOSE_PASSWORD, DECOMPOSE_DATABASE); $tableResult = mysqli_query($con, $query); for ($i = 0; $i < $tableResult->num_rows; $i++) { $finalTbResult[] = mysqli_fetch_array($tableResult); } if (!empty($this->parser->parsed['SELECT'][0]['alias'])) { echo "<div class='alert alert-danger' role='alert'>"; echo "Alias is not supported by this version of the viSQLizer prototype!"; echo "</div>"; } if ($this->parser->parsed['SELECT'][0]['expr_type'] == "aggregate_function") { echo "<div class='alert alert-danger' role='alert'>"; echo "Aggregate functions is not supported by this version of the viSQLizer prototype!"; echo "</div>"; } if ($this->parser->parsed['FROM'][0]['alias']['name'] == "NATURAL") { echo "<div class='alert alert-danger' role='alert'>"; echo "NATURAL JOIN is not supported by this version of the viSQLizer prototype!"; echo "</div>"; } if (empty($this->parser->parsed['SELECT'][0]['alias']) && $this->parser->parsed['SELECT'][0]['expr_type'] != "aggregate_function" && $this->parser->parsed['FROM'][0]['alias']['name'] != "NATURAL") { echo "<div class='panel panel-default streammode-panel' id='main-panel streammode-panel'><div class='panel-heading'><h3 class='panel-title'> Step " . $thisStep . " of " . $thisNumStep . "</h3></div>"; //print_r($this->singleStepTable[$step]); echo "<div class='panel-body'>"; foreach ($this->singleStepTable[$step] as $output) { if ($output['type'] == 'text' or $output['type'] == 'query') { echo "<div class='alert alert-info-decomposer' role='alert'>" . $output['contents'] . "</div>"; } else { if ($output['type'] == 'table') { $TBL = new tbl(); $TBL->make_table($output['contents'], true, "dbtable", true, $step, $tableName, $this->whereColumns, $this->onColumns, $this->onOrderBy, $this->onGroupBy, $this->singleStepTable, $sql, $this->parser->parsed, $this->isMultipleJoin, $thisStep); } } } echo "</div>"; if ($thisNumStep > 1) { echo "<div class='panel-footer wizard-footer' style='text-align: center;'><ul class='pagination' style='margin: auto;'><li class='previous'><a href='#' onclick='stepClicked()'>Previous</a></li>"; $stepCounter = 1; for ($i = 1; $i <= $numOfSteps; $i++) { if ($i > count($tableName[0])) { echo "<li class='step step" . $stepCounter . "'><a id='astep" . $stepCounter . "' href='#' onclick='stepClicked()' class='" . $i . "'>" . $stepCounter . "</a></li>"; $stepCounter++; } } echo "<li class='next'><a href='#' onclick='stepClicked()'>Next</a></li></ul></div></div>"; } else { echo "</div>"; } } }
<div class="panel-heading"><h3 class="panel-title"><span class="glyphicon glyphicon-th-list"></span> Database tables</h3></div> <?php $tables = "SHOW TABLES"; $tablesresult = mysqli_query($con, $tables); $result_array_select_tables; for ($i = 0; $i <= $tablesresult->num_rows; $i++) { $result_array_select_tables[] = mysqli_fetch_array($tablesresult); } $MENUTBL = new tbl(); $MENUTBL->make_table($result_array_select_tables, false, "databaseTables"); ?> </div> <div class="panel panel-info"> <div class="panel-heading"><h3 class="panel-title"><span class="glyphicon glyphicon-star"></span> Saved queries</h3></div> <?php $tucon = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD, ADMIN_DATABASE); $favorites = "SELECT query FROM saved_queries WHERE username = '******'"; $favoritesresult = mysqli_query($tucon, $favorites); $result_array_select_favorites; for ($i = 0; $i <= $favoritesresult->num_rows; $i++) { $result_array_select_favorites[] = mysqli_fetch_array($favoritesresult); } $MENUTBLFAV = new tbl(); $MENUTBLFAV->make_table($result_array_select_favorites, false, "savedQueries"); ?> </div> </div> </div> </body> </html>