[Firebug-cvs] firebug/web/demo results.php,1.2,1.3
Brought to you by:
doolin
From: David M. D. <do...@us...> - 2004-04-01 15:09:25
|
Update of /cvsroot/firebug/firebug/web/demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32680/demo Modified Files: results.php Log Message: Added more php scripts for post processing. Index: results.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/demo/results.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** results.php 13 Mar 2004 05:09:02 -0000 1.2 --- results.php 1 Apr 2004 14:57:25 -0000 1.3 *************** *** 15,30 **** <h1>Demonstration monitoring</h1> <?php ! /** ! * Lots of broken code in here, mostly related to the ! * system() function. The workaround is not pretty, ! * the strings will need to be handled using lots of ! * small functions. ! */ mysql_connect("localhost","root","") or die("Error: ".mysql_error()." in mysql_connect."); ! $statement = "use gpsradio"; mysql_query($statement) or die("Error: ".mysql_error()." changing databases"); --- 15,186 ---- <h1>Demonstration monitoring</h1> + + <!-- + <form action="db_select.php" method="post"> + --> + + <form action="results.php" method="post"> + <?php + if ($HTTP_POST_VARS["tbl1"]!=Null){ + $HTTP_SESSION_VARS["tblname"] = $HTTP_POST_VARS["tbl1"]; + $HTTP_SESSION_VARS["dbname"] = $HTTP_POST_VARS["db1"]; + $HTTP_SESSION_VARS["checkboxname"] = $HTTP_POST_VARS["cb"]; + } ! $dbname = $HTTP_POST_VARS["db1"]; ! $tblname = $HTTP_SESSION_VARS["tblname"]; ! $checkboxname = $HTTP_SESSION_VARS["cb"]; ! ! include("../db_list_component.php"); ! ?> ! <input type="submit" value="Show tables"> ! </form> ! ! ! ! ! <form action="results.php" method="post"> ! ! <?php ! ! //$dbname = $HTTP_POST_VARS["db1"]; mysql_connect("localhost","root","") or die("Error: ".mysql_error()." in mysql_connect."); + $dblink=mysql_select_db("$dbname") or die("Error: ".mysql_error()." in mysql_select_db."); ! ! ! print("<h1>Database $dbname tables</h1>"); ! ! ! print("<center>\n"); ! print("<table class='db_schema'><tr><td>Table Name</td><td>Selected</td></tr>"); ! ! $result = mysql_list_tables($dbname); ! if($result) ! { ! while ($row = mysql_fetch_row($result)) { ! print ("<tr>"); ! ! print ("<td>"); ! print $row[0]; ! print ("</td>"); ! ! print ("<td>"); ! print ("<input type=radio name=tbl1 value=\"" . htmlspecialchars($row[0]) . "\">"); ! print ("</td>"); ! ! print ("</tr>"); ! } ! print ("</table>"); ! print ("<input type=hidden name=db1 value=\"$dbname\">"); ! print ("<input type=submit value=SUBMIT>"); ! } ! ?> ! ! </table> ! </form> ! </center> ! ! <form action="results.php" method="post"> ! ! <table class="db_schema"> ! <?php ! // Build the table header column names. Make this into a function. ! $statement = "show columns from $tblname;"; ! $columns = mysql_query($statement) or die("Error: ".mysql_error()." getting columns"); ! if ($columnname = mysql_fetch_array($columns)) { ! ! print("<tr>\n"); ! $names = array(); ! do { ! print ("<td>"); ! array_push($names, $columnname[0]); ! print $columnname[0]; ! print ("</td>"); ! print ("<td>"); ! print ("<input type=checkbox name=cb value=\"" . htmlspecialchars($row[0]) . "\">"); ! print ("</td>"); ! } while ($columnname = mysql_fetch_array($columns)); ! print("</tr>\n"); ! // This is pretty cool for debugging. ! //print_r($names); ! } ! print("</table>"); ! print ("<input type=hidden name=db1 value=\"$dbname\">"); ! print ("<input type=submit value=\"Checkbox\">"); ! ! print("<br />Checkbox name: ".$checkboxname."\n"); ! ?> ! </form> ! ! <?php ! echo "<table class=\"db_schema\">"; ! ! $statement = "show columns from $tblname;"; ! $columns = mysql_query($statement) or die("Error: ".mysql_error()." getting columns"); ! ! ! // Build the table header column names. Make this into a function. ! if ($columnname = mysql_fetch_array($columns)) { ! ! print("<tr>\n"); ! $names = array(); ! do { ! print ("<td>"); ! array_push($names, $columnname[0]); ! print $columnname[0]; ! print ("</td>"); ! } while ($columnname = mysql_fetch_array($columns)); ! print("</tr>\n"); ! // This is pretty cool for debugging. ! //print_r($names); ! } ! ! ! ! ! ! ! $statement = "select * from $tblname"; ! $result = mysql_query($statement); ! ! ! //Print the value for a row. ! ! function print_table_row($item2,$key) { ! ! print ("<td>\n"); ! echo "$item2\n"; ! print ("</td>\n"); ! } ! ! ! ! // Print every row. ! if ($row = mysql_fetch_row($result)) { ! ! // for each row ! do { ! // For each column... ! print ("<tr>"); ! $row = array_values($row); ! array_walk($row,'print_table_row'); ! print ("</tr>"); ! } while ($row = mysql_fetch_row($result)); ! } ! ! ! ?> ! </table> ! ! ! ! <?php ! ! $dbname = "gpsradio"; ! //$statement = "use gpsradio"; ! $statement = "use $dbname"; mysql_query($statement) or die("Error: ".mysql_error()." changing databases"); *************** *** 122,131 **** */ ! echo "<img src=\"test.png\">"; ?> --- 278,291 ---- */ ! echo "<center>"; echo "<img src=\"test.png\">"; + echo "</center>"; ?> + <?php + include("../nav_footer.php"); + ?> |