[llvm-commits] CVS: nightlytest-serverside/SQLQuery.php
Jim Laskey
jlaskey at apple.com
Tue Sep 19 10:46:24 PDT 2006
Changes in directory nightlytest-serverside:
SQLQuery.php updated: 1.3 -> 1.4
---
Log message:
make multiple queries easier
---
Diffs of the changes: (+36 -27)
SQLQuery.php | 63 +++++++++++++++++++++++++++++++++--------------------------
1 files changed, 36 insertions(+), 27 deletions(-)
Index: nightlytest-serverside/SQLQuery.php
diff -u nightlytest-serverside/SQLQuery.php:1.3 nightlytest-serverside/SQLQuery.php:1.4
--- nightlytest-serverside/SQLQuery.php:1.3 Fri Sep 15 07:16:26 2006
+++ nightlytest-serverside/SQLQuery.php Tue Sep 19 12:46:04 2006
@@ -1,11 +1,11 @@
<?php
$user = $_POST["User"];
$password = $_POST["Password"];
-$query = $_POST["Query"];
-$was_query = isset($query);
+$queries = $_POST["Queries"];
+$was_query = isset($queries);
if (!isset($user)) $user = "";
if (!isset($password)) $password = "";
-if (!isset($query)) $query = "";
+if (!isset($queries)) $queries = "";
?>
<HTML>
@@ -31,7 +31,7 @@
<TD>Password:</TD> <TD><INPUT NAME="Password" ID="Password" TYPE="password" VALUE="$password" SIZE="30"><BR></TD>
</TR>
<TR>
- <TD>Query:</TD> <TD><INPUT NAME="Query" ID="Query" TYPE="text" VALUE="$query" SIZE="100"><BR></TD>
+ <TD>Query:</TD> <TD><TEXTAREA ID="Queries" NAME="Queries" ROWS="10" COLS="100"></TEXTAREA><BR></TD>
</TR>
</TABLE>
<BUTTON TYPE="submit" ID="Send" NAME="Send" VALUE="Send">Query</BUTTON><BR>
@@ -39,36 +39,45 @@
EOD;
if ($was_query) {
+ $queries = split("\n", $queries);
+
$mysql_link = mysql_connect("127.0.0.1", $user, $password) or die("Error: could not connect to database!\n");
mysql_select_db("nightlytestresults");
- $query = $_POST["Query"];
- $my_query = mysql_query($query) or die (mysql_error());
-
- print "<TABLE>\n";
- $heading = false;
-
- while ($row = mysql_fetch_assoc($my_query)) {
- if (!$heading) {
- print " <TR STYLE=\"font-weight: bold;\">\n";
- foreach ($row as $key => $value) {
- print " <TD>$key</TD>\n";
- }
- print " </TR>\n";
- $heading = true;
- }
+ foreach ($queries as $query) {
+ $query = rtrim($query);
+ if (strlen($query) == 0) continue;
- print " <TR>\n";
- foreach ($row as $key => $value) {
- print " <TD>$value</TD>\n";
+ if ($my_query = mysql_query($query)) {
+ print "<TABLE>\n";
+ $heading = false;
+
+ while ($row = mysql_fetch_assoc($my_query)) {
+ if (!$heading) {
+ print " <TR STYLE=\"font-weight: bold;\">";
+ foreach ($row as $key => $value) {
+ print " <TD>$key</TD>";
+ }
+ print " </TR>\n";
+ $heading = true;
+ }
+
+ print " <TR>";
+ foreach ($row as $key => $value) {
+ print " <TD>$value</TD>";
+ }
+ print " </TR>\n";
+ }
+
+ print "</TABLE><BR><BR><BR>\n";
+
+ mysql_free_result($my_query);
+ } else {
+ $error = mysql_error();
+ print "$error<BR>\n";
}
- print " </TR>\n";
}
- print "</TABLE>\n";
-
- mysql_free_result($my_query);
-
mysql_close($mysql_link);
}
More information about the llvm-commits
mailing list