Hello All,

                        I’m working on a project here at our university and need a little.  We installed a wireless network and bought 5 ipaq’s to use and experiment with.  I wrote a work order system that we are still using. Basically the tech guys want to be able to check WO from the ipaq’s and if they finish them fill in a check box and have it be updated in the WO database and not be displayed on the open or uncompleted work order page. I can do everything except when the completed box is filled I can’t get it to fill in the database. Below is the code I’m using. Keep in mind it is being displayed on a ipaq so the headings are brief. Also I’m working on my local computer before it is put in production. Any help would be appreciated.

 

TIA – Frank

 

<?php

if(!$HTTP_POST_VARS['submit']) {

 

 

// initialize database connection

$connection = mysql_connect("localhost") or

die("Couldn't connect to the database!");

 // select database

mysql_select_db("techsupport", $connection);

//formulate and run query

$query = "SELECT * FROM techsupport where (Completed = 'N' or Completed = 'n') and TCompleted='N' ORDER by WONumber DESC";

$result = mysql_query($query,$connection) or die("Error in Query");

 

$per_page = 10;

if(!$page) {

    $page = 1;

}

$prev_page = $page - 1;

$next_page = $page + 1;

 

$page_start = ($per_page * $page ) - $per_page;

$num_rows = mysql_num_rows($result);

 

if ($num_rows <= $per_page) {

     $num_pages = 1;

}

else if (($num_rows % $per_page) == 0) {

     $num_pages = ($num_rows / $per_page);

}

else {

    $num_pages = ($num_rows / $per_page) +1;

}

$num_pages = (int)$num_pages;

 

if (($page > $num_pages) || ($page < 0)) {

      error("You have specified an invalid page number");

}

$query = $query . " LIMIT $page_start, $per_page";

$result = mysql_query($query,$connection) or die("Error in Query2");

 

echo "

<HTML><HEAD>

<TITLE>TECH-DE Check Work Orders</TITLE>

</HEAD>

<BODY>

<P align=left>

<FORM method=\"POST\" ACTION=\"$PHP_SELF\" >    

<INPUT type=\"submit\" value=\"Update Work Orders\">

</p>

<P align=left>T = Finished by Technician</P>

<table width=230 border=0>

<tr>

<td width=25 align=center bgcolor=\"#00FFFF\"><font face=\"Verdana\"><small><b>#</b></small></font></td>

<td width=25 align=center bgcolor=\"#00FFFF\"><font face=\"Verdana\"><small><b>T</b></small></font></td>

<td width=45 align=left bgcolor=\"#00FFFF\"><font face=\"Verdana\"><small><b>Req.</b></small></font></td>

<td width=135 align=left bgcolor=\"#00FFFF\"><font face=\"Verdana\"><small><b>Situation</b></small></font></td>

</tr>";

while ($row = mysql_fetch_array($result)) {

          $WONumber = $row["WONumber"];

          $Completed = $row["Completed"];

          $Requestedby = $row["Requestedby"];

          $Situation = $row["Situation"];

          $Shortsit = substr($Situation, 0, 25);

          if ($color=="#CCFFFF") {

             $color="#00FFFF";

             } else {

             $color = "#CCFFFF";

          }

          echo "<tr><td width=25 bgcolor=\"$color\"><center>

          <a href="\"viewwo.php?WONumber=$WONumber\">$WONumber</a></center></td>

          <td width=25 bgcolor=\"$color\"><center><small>

          <font face=\"Verdana\"><input type=\"checkbox\" name=\"Checkbox[]\" Value=$WONumber></font></small></center></td>

          <td width=25 bgcolor=\"$color\"><center><small>

          <font face=\"Verdana\">$Requestedby</font></small></center></td>

          <td width=110 bgcolor=\"$color\"><center><small>

          <font face=\"Verdana\">$Shortsit</font></small></center></td></tr>";

          }

echo "</table><table width=230 border=0><tr>";

if ($prev_page) {

echo "<td width=30><a href="\"$PHP_SELF?page=$prev_page\">Prev</a>" </td>";

}

else {

 echo "<td width=30>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>";

}

 

echo "<td width=160 align=center>";

for ($i = 1; $i <= $num_pages; $i++) {

 if ($i != $page ) {

    echo " <a href="\"$PHP_SELF?page=$i\">$i</a>" ";

} else {

          echo " $i ";

       }

}

echo "</td>";

 

if ($page != $num_pages) {

   echo "<td width=30 align=right><a href="\"$PHP_SELF?page=$next_page\">Next</a>";  "

}

else {

 echo "<td width=30></td>";

}

echo "</tr></table>";

mysql_free_result($result);

mysql_close($connection);

echo "</form>

</body>

</html>";

}

else {

// initialize database connection

print $WONumber;

$connection = mysql_connect("localhost") or

die("Couldn't connect to the database!");

 // select database

mysql_select_db("techsupport", $connection);

//formulate and run query

$query = "update techsupport set TCompleted='Y'where $WONumber=$Checkbox[0]";

$result = mysql_query($query,$connection) or die("Error in Query2");

}

 

 

?>

 

Frank Miller

Computer Specialist and Webmaster

Texas A&M University-Texarkana

2600 N. Robison Rd

Texarkana, Texas 75501

 

Office  165

Phone (903)223-3156

Fax     (903)223-3139

 

Attachment: smime.p7s
Description: application/pkcs7-signature

Reply via email to