[Firebug-cvs] firebug/web db_create.php,1.12,1.13 db_table_select.php,1.4,1.5
Brought to you by:
doolin
From: <do...@us...> - 2004-03-09 20:20:16
|
Update of /cvsroot/firebug/firebug/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19849 Modified Files: db_create.php db_table_select.php Log Message: Completely rewrote the table display php script. Index: db_create.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/db_create.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** db_create.php 18 Feb 2004 15:32:15 -0000 1.12 --- db_create.php 9 Mar 2004 20:02:38 -0000 1.13 *************** *** 54,58 **** */ ! $statement = "CREATE TABLE location (mote_id SMALLINT, time TIMESTAMP, gps_hours SMALLINT, gps_minutes SMALLINT, gps_seconds FLOAT, lat_deg SMALLINT,"; $statement .= "lat_dec_min FLOAT, long_deg SMALLINT, long_dec_min FLOAT, nsew SMALLINT, numsats SMALLINT)"; --- 54,58 ---- */ ! $statement = "CREATE TABLE location (mote_id SMALLINT, gps_hours SMALLINT, gps_minutes SMALLINT, gps_seconds FLOAT, lat_deg SMALLINT,"; $statement .= "lat_dec_min FLOAT, long_deg SMALLINT, long_dec_min FLOAT, nsew SMALLINT, numsats SMALLINT)"; *************** *** 77,80 **** --- 77,84 ---- mysql_query($statement) or die("Error: ".mysql_error()." in creating cumulative atable"); + + $statement = "CREATE TABLE range (mote_id SMALLINT, count INTEGER, rssi INTEGER)"; + mysql_query($statement) or die("Error: ".mysql_error()." in creating range table"); + ?> Index: db_table_select.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/db_table_select.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** db_table_select.php 11 Feb 2004 00:05:24 -0000 1.4 --- db_table_select.php 9 Mar 2004 20:02:38 -0000 1.5 *************** *** 29,34 **** </p> - - <?php //if (!isset($HTTP_SESSION_VARS["tblname"])) { --- 29,32 ---- *************** *** 43,69 **** print("<h1>Mote activity: Database $dbname, table $tblname</h1>"); ?> - - <center> <table class="db_schema"> - <tr> - <td>Mote ID</td> - <td>Time</td> - <td>Hours</td> - <td>Minutes</td> - <td>Dec_sec</td> - <td>Lat_deg</td> - <td>Lat_dec_min</td> - <td>Long_deg</td> - <td>Long_dec_min</td> - <td>NSEWind</td> - <td>Temp</td> - <td>Cnt </td> - </tr> - - <?php mysql_connect("localhost","root","") or die("Error: ".mysql_error()." in mysql_connect."); --- 41,50 ---- print("<h1>Mote activity: Database $dbname, table $tblname</h1>"); ?> <center> <table class="db_schema"> + <?php mysql_connect("localhost","root","") or die("Error: ".mysql_error()." in mysql_connect."); *************** *** 71,204 **** mysql_select_db("$dbname") or die("Error: ".mysql_error()." in mysql_select_db."); ! if ($mote_id == "") { ! $mote_id = "%"; ! } ! ! if ($time == "") { ! $time = "%"; ! } ! ! if ($cnt == "") { ! $cnt = "%"; ! } ! ! if ($hours == "") { ! $hours = "%"; ! } - if ($minutes == "") { - $minutes = "%"; - } ! if ($dec_sec == "") { ! $dec_sec = "%"; ! } ! if ($Lat_deg == "") { ! $Lat_deg = "%"; } ! if ($Lat_dec_min == "") { ! $Lat_dec_min = "%"; ! } ! ! if ($Long_deg == "") { ! $Long_deg = "%"; ! } - if ($Long_dec_min == "") { - $Long_dec_min = "%"; - } ! if ($NSEWind == "") { ! $NSEWind = "%"; ! } ! if ($temp == "") { ! $temp = "%"; } ! $result = mysql_query("select * from $tblname ! where mote_id like '$mote_id%' ! and time like '$time%' ! and cnt like '$cnt%' ! and hours like '$hours%' ! and minutes like '$minutes%' ! and dec_sec like '$dec_sec%' ! and Lat_deg like '$Lat_deg%' ! and Lat_dec_min like '$Lat_dec_min%' ! and Long_deg like '$Long_deg%' ! and Long_dec_min like '$Long_dec_min%' ! and NSEWind like '$NSEWind%' ! and temp like '$temp%'") ! //and rel_hum like '$rel_hum%' ! //and baro_pres like '$baro_pres%'" ! or die("Error: ".mysql_error()." in query."); ! ! ! if ($row = mysql_fetch_array($result)) { ! do { ! ! print ("<tr>"); ! ! print ("<td>"); ! print $row["mote_id"]; ! print ("</td>"); ! ! print ("<td>"); ! print $row["time"]; ! print ("</td>"); ! ! print ("<td>"); ! print $row["hours"]; ! print ("</td>"); ! ! print ("<td>"); ! print $row["minutes"]; ! print ("</td>"); ! ! print ("<td>"); ! print $row["dec_sec"]; ! print ("</td>"); ! ! print ("<td>"); ! print $row["Lat_deg"]; ! print ("</td>"); ! ! print ("<td>"); ! print $row["Lat_dec_min"]; ! print ("</td>"); ! ! print ("<td>"); ! print $row["Long_deg"]; ! print ("</td>"); ! ! print ("<td>"); ! print $row["Long_dec_min"]; ! print ("</td>"); ! ! print ("<td>"); ! print $row["NSEWind"]; ! print ("</td>"); ! ! print ("<td>"); ! print $row["temp"]; ! print ("</td>"); ! ! print ("<td>"); ! print $row["cnt"]; ! print ("</td>"); ! ! ! print ("</tr>"); ! } while ($row = mysql_fetch_array($result)); } - - - ?> --- 52,100 ---- mysql_select_db("$dbname") or die("Error: ".mysql_error()." in mysql_select_db."); ! $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_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_row'); print ("</tr>"); ! } while ($row = mysql_fetch_row($result)); } ?> |