Jump to content

[HELP] Multiple Updating in PHP


sajy2k

Recommended Posts

I have attach the picture of the web page i'm creating now. I want to make it like when user tick all the checkbox and click submit, the page must update the database where the verify checkbox is ticked for the particular record and verified name for each record. Now when i tick certain checkbox, The page only tick the last row checkbox and name of the verifier for the last row of the record only. please help me on this. Thank You

 

<?php require_once('Connections/checklist.php'); ?>

<?php

//initialize the session

if (!isset($_SESSION)) {

  session_start();

}

 

// ** Logout the current user. **

$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";

if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){

  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);

}

 

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){

  //to fully log out a visitor we need to clear the session varialbles

  $_SESSION['MM_Username'] = NULL;

  $_SESSION['MM_UserGroup'] = NULL;

  $_SESSION['PrevUrl'] = NULL;

  unset($_SESSION['MM_Username']);

  unset($_SESSION['MM_UserGroup']);

  unset($_SESSION['PrevUrl']);

 

  $logoutGoTo = "index.php";

  if ($logoutGoTo) {

    header("Location: $logoutGoTo");

    exit;

  }

}

?>

<?php require_once('Connections/login.php'); ?>

<?php

if (!isset($_SESSION)) {

  session_start();

}

$MM_authorizedUsers = "";

$MM_donotCheckaccess = "true";

 

// *** Restrict Access To Page: Grant or deny access to this page

function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {

  // For security, start by assuming the visitor is NOT authorized.

  $isValid = False;

 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.

  // Therefore, we know that a user is NOT logged in if that Session variable is blank.

  if (!empty($UserName)) {

    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.

    // Parse the strings into arrays.

    $arrUsers = Explode(",", $strUsers);

    $arrGroups = Explode(",", $strGroups);

    if (in_array($UserName, $arrUsers)) {

      $isValid = true;

    }

    // Or, you may restrict access to only certain users based on their username.

    if (in_array($UserGroup, $arrGroups)) {

      $isValid = true;

    }

    if (($strUsers == "") && true) {

      $isValid = true;

    }

  }

  return $isValid;

}

 

$MM_restrictGoTo = "noaccess.php";

if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { 

  $MM_qsChar = "?";

  $MM_referrer = $_SERVER['PHP_SELF'];

  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";

  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)

  $MM_referrer .= "?" . $QUERY_STRING;

  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);

  header("Location: ". $MM_restrictGoTo);

  exit;

}

?>

<?php

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

 

  switch ($theType) {

    case "text":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;   

    case "long":

    case "int":

      $theValue = ($theValue != "") ? intval($theValue) : "NULL";

      break;

    case "double":

      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";

      break;

    case "date":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;

    case "defined":

      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

      break;

  }

  return $theValue;

}

 

$editFormAction = $_SERVER['PHP_SELF'];

if (isset($_SERVER['QUERY_STRING'])) {

  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

 

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {

  $updateSQL = sprintf("UPDATE ict_checklist SET platform=%s, duedate=%s, verify=%s, verified=%s WHERE fiid=%s AND pmdate=%s",

                      GetSQLValueString($_POST['platform'], "text"),

                      GetSQLValueString($_POST['duedate'], "date"),

                      GetSQLValueString(isset($_POST['verify']) ? "true" : "", "defined","'Y'","'N'"),

                      GetSQLValueString($_POST['username'], "text"),

                      GetSQLValueString($_POST['fiid'], "text"),

                      GetSQLValueString($_POST['pmdate'], "date"));

 

  mysql_select_db($database_checklist, $checklist);

  $Result1 = mysql_query($updateSQL, $checklist) or die(mysql_error());

 

  $updateGoTo = "sucess.php";

  if (isset($_SERVER['QUERY_STRING'])) {

    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";

    $updateGoTo .= $_SERVER['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $updateGoTo));

}

 

$currentPage = $_SERVER["PHP_SELF"];

 

$colname_Recordset1 = "1";

if (isset($_GET['platform'])) {

  $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['platform'] : addslashes($_GET['platform']);

}

$colname2_Recordset1 = "1";

if (isset($_GET['month'])) {

  $colname2_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['month'] : addslashes($_GET['month']);

}

$colname3_Recordset1 = "1";

if (isset($_GET['year'])) {

  $colname3_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['year'] : addslashes($_GET['year']);

}

mysql_select_db($database_checklist, $checklist);

$query_Recordset1 = sprintf("select * from ict_checklist where platform = '%s' and monthname(pmdate) = '%s' and year(pmdate) = '%s'", $colname_Recordset1,$colname2_Recordset1,$colname3_Recordset1);

$Recordset1 = mysql_query($query_Recordset1, $checklist) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

 

$colname_Recordset2 = "1";

if (isset($_SESSION['MM_Username'])) {

  $colname_Recordset2 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);

}

mysql_select_db($database_login, $login);

$query_Recordset2 = sprintf("SELECT name FROM users WHERE username = '%s'", $colname_Recordset2);

$Recordset2 = mysql_query($query_Recordset2, $login) or die(mysql_error());

$row_Recordset2 = mysql_fetch_assoc($Recordset2);

$totalRows_Recordset2 = mysql_num_rows($Recordset2);

 

$queryString_Recordset1 = "";

if (!empty($_SERVER['QUERY_STRING'])) {

  $params = explode("&", $_SERVER['QUERY_STRING']);

  $newParams = array();

  foreach ($params as $param) {

    if (stristr($param, "pageNum_Recordset1") == false &&

        stristr($param, "totalRows_Recordset1") == false) {

      array_push($newParams, $param);

    }

  }

  if (count($newParams) != 0) {

    $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));

  }

}

$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);

?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Verification</title>

</head>

 

<body background="blue-simple-background.1600x1200.jpg">

<div align="center">

  <p><img src="http://img512.imageshack.us/img512/4968/flexlogocs6.jpg" width="700" height="72"></p>

  <table width="973" border="0" align="center">

    <tr>

      <td width="1176" bgcolor="#669966"><b><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Verification of Records </font></b></td>

    </tr>

  </table>

  <div align="right">

    <p><a href="<?php echo $logoutAction ?>">Log out</a></p>

    <p align="center">

      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="108" height="46">

        <param name="movie" value="button5.swf">

        <param name="quality" value="high">

        <param name="bgcolor" value="#6699CC">

        <embed src="button5.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="108" height="46" bgcolor="#6699CC"></embed>

      </object>

    </p>

  </div>

</div>

<?php if ($totalRows_Recordset1 == 0) { // Show if recordset empty ?>

  <div align="center"><strong><font color="#FF0000" size="3" face="Georgia, Times New Roman, Times, serif">Sorry, No Result Found</font></strong></div>

  <?php } // Show if recordset empty ?>

<?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>

 

  <form action="<?php echo $editFormAction; ?>" name="form1" method="POST">

    <div align="left">

      <table width="733" border="1" align="center">

        <tr>

          <td width="63" height="21" bordercolor="#000000" bgcolor="#000099"><div align="center"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Platform</font></strong></font></div></td>

          <td width="32" bordercolor="#000000" bgcolor="#000099"><div align="center"><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">FIID</font></strong></div></td>

          <td width="94" bordercolor="#000000" bgcolor="#000099"><div align="center"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Fixture Model </font></strong></font></div></td>

          <td width="39" bordercolor="#000000" bgcolor="#000099"><div align="center"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">PM Date </font></strong></font></div></td>

          <td width="39" bordercolor="#000000" bgcolor="#000099"><div align="center"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Due Date </font></strong></font></div></td>

          <td width="141" bordercolor="#000000" bgcolor="#000099"><div align="justify"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Comments</font></strong></font></div></td>

          <td width="112" bordercolor="#000000" bgcolor="#000099"><div align="center"><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Added</font></strong></div></td>

          <td width="126" bordercolor="#000000" bgcolor="#000099"><div align="center"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Updated</font></strong></font></div></td>

          <td width="43" bordercolor="#000000" bgcolor="#000099"><div align="center"><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Verify</font></strong></div></td>

        </tr>

        <?php do { ?>

          <tr>

            <td bgcolor="#FFFFFF"><div align="center"><font size="2" face="Geneva, Arial, Helvetica, sans-serif">

              <input name="platform" type="text" value="<?php echo $row_Recordset1['platform']; ?>" size="2" readonly="true">

            </font></div></td>

            <td bgcolor="#FFFFFF"><div align="center"><font size="2" face="Geneva, Arial, Helvetica, sans-serif">

              <input name="fiid" type="text" value="<?php echo $row_Recordset1['fiid']; ?>" size="5" readonly="true">

            </font></div></td>

            <td bgcolor="#FFFFFF"><div align="justify"><font size="2" face="Geneva, Arial, Helvetica, sans-serif"><?php echo $row_Recordset1['fm']; ?></font></div></td>

            <td bgcolor="#FFFFFF"><div align="justify"><font size="2" face="Geneva, Arial, Helvetica, sans-serif">

              <input name="pmdate" type="text" value="<?php echo $row_Recordset1['pmdate']; ?>" size="7" readonly="true">

            </font></div></td>

            <td bgcolor="#FFFFFF"><div align="justify"><font size="2" face="Geneva, Arial, Helvetica, sans-serif">

              <input name="duedate" type="text" value="<?php echo $row_Recordset1['duedate']; ?>" size="7" readonly="true">

            </font></div></td>

            <td bgcolor="#FFFFFF"><div align="justify"><font size="2" face="Geneva, Arial, Helvetica, sans-serif"><?php echo $row_Recordset1['comments']; ?></font></div></td>

            <td bgcolor="#FFFFFF"><div align="justify"><font size="2" face="Geneva, Arial, Helvetica, sans-serif"><?php echo $row_Recordset1['name']; ?></font></div></td>

            <td bgcolor="#FFFFFF"><div align="justify"><font size="2" face="Geneva, Arial, Helvetica, sans-serif"><?php echo $row_Recordset1['updated']; ?></font></div></td>

            <td bgcolor="#FFFFFF">

             

              <div align="center">

                <input <?php if (!(strcmp($row_Recordset1['verify'],1))) {echo "checked=\"checked\"";} ?> <?php if (!(strcmp($row_Recordset1['verify'],"Y"))) {echo "checked=\"checked\"";} ?> name="verify" type="checkbox" id="verify" value="<?php echo $row_Recordset1['verify']; ?>">

            </div></td>

          </tr>

          <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

      </table>

    </div>

    <p align="center"><font color="#FFFFFF">This records are verified by :</font>

      <input name="username" type="text" value="<?php echo ucfirst($row_Recordset2['name']); ?>" size="12" readonly="true">

    </p>

    <p align="center">

      <input type="submit" name="Submit" value="Submit">

    </p>

    <div align="left"> </div>

    <input type="hidden" name="MM_update" value="form1">

  </form>

<?php } // Show if recordset not empty ?>

</body>

</html>

<?php

mysql_free_result($Recordset1);

 

mysql_free_result($Recordset2);

?>

 

The above is the source code of the file, the database consist of a table called ict_checklist where the columns inside are included with the verify column for checkboxes and verified column for name of the user who verifying.

 

[attachment deleted by admin]

Link to comment
Share on other sites

<?php require_once('Connections/checklist.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
   
  $logoutGoTo = "index.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php require_once('Connections/login.php'); ?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
  // For security, start by assuming the visitor is NOT authorized.
  $isValid = False;

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
  // Therefore, we know that a user is NOT logged in if that Session variable is blank.
  if (!empty($UserName)) {
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
    // Parse the strings into arrays.
    $arrUsers = Explode(",", $strUsers);
    $arrGroups = Explode(",", $strGroups);
    if (in_array($UserName, $arrUsers)) {
      $isValid = true;
    }
    // Or, you may restrict access to only certain users based on their username.
    if (in_array($UserGroup, $arrGroups)) {
      $isValid = true;
    }
    if (($strUsers == "") && true) {
      $isValid = true;
    }
  }
  return $isValid;
}

$MM_restrictGoTo = "noaccess.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
  $MM_referrer .= "?" . $QUERY_STRING;
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo);
  exit;
}
?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;   
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE ict_checklist SET platform=%s, duedate=%s, verify=%s, verified=%s WHERE fiid=%s AND pmdate=%s",
                       GetSQLValueString($_POST['platform'], "text"),
                       GetSQLValueString($_POST['duedate'], "date"),
                       GetSQLValueString(isset($_POST['verify']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString($_POST['username'], "text"),
                       GetSQLValueString($_POST['fiid'], "text"),
                       GetSQLValueString($_POST['pmdate'], "date"));

  mysql_select_db($database_checklist, $checklist);
  $Result1 = mysql_query($updateSQL, $checklist) or die(mysql_error());

  $updateGoTo = "sucess.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

$currentPage = $_SERVER["PHP_SELF"];

$colname_Recordset1 = "1";
if (isset($_GET['platform'])) {
  $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['platform'] : addslashes($_GET['platform']);
}
$colname2_Recordset1 = "1";
if (isset($_GET['month'])) {
  $colname2_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['month'] : addslashes($_GET['month']);
}
$colname3_Recordset1 = "1";
if (isset($_GET['year'])) {
  $colname3_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['year'] : addslashes($_GET['year']);
}
mysql_select_db($database_checklist, $checklist);
$query_Recordset1 = sprintf("select * from ict_checklist where platform = '%s' and monthname(pmdate) = '%s' and year(pmdate) = '%s'", $colname_Recordset1,$colname2_Recordset1,$colname3_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $checklist) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

$colname_Recordset2 = "1";
if (isset($_SESSION['MM_Username'])) {
  $colname_Recordset2 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_login, $login);
$query_Recordset2 = sprintf("SELECT name FROM users WHERE username = '%s'", $colname_Recordset2);
$Recordset2 = mysql_query($query_Recordset2, $login) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);

$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset1") == false &&
        stristr($param, "totalRows_Recordset1") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Verification</title>
</head>

<body background="blue-simple-background.1600x1200.jpg">
<div align="center">
  <p></p>
  <table width="973" border="0" align="center">
    <tr>
      <td width="1176" bgcolor="#669966"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Verification of Records </font></td>
    </tr>
  </table>
  <div align="right">
    <p><a href="<?php echo $logoutAction ?>">Log out[/url]</p>
    <p align="center">
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="108" height="46">
        <param name="movie" value="button5.swf">
        <param name="quality" value="high">
        <param name="bgcolor" value="#6699CC">
        <embed src="button5.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="108" height="46" bgcolor="#6699CC"></embed>
      </object>
    </p>
  </div>
</div>
<?php if ($totalRows_Recordset1 == 0) { // Show if recordset empty ?>
  <div align="center"><strong><font color="#FF0000" size="3" face="Georgia, Times New Roman, Times, serif">Sorry, No Result Found</font></strong></div>
  <?php } // Show if recordset empty ?>
<?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>

  <form action="<?php echo $editFormAction; ?>" name="form1" method="POST">
    <div align="left">
      <table width="733" border="1" align="center">
        <tr>
          <td width="63" height="21" bordercolor="#000000" bgcolor="#000099"><div align="center"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Platform</font></strong></font></div></td>
          <td width="32" bordercolor="#000000" bgcolor="#000099"><div align="center"><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">FIID</font></strong></div></td>
          <td width="94" bordercolor="#000000" bgcolor="#000099"><div align="center"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Fixture Model </font></strong></font></div></td>
          <td width="39" bordercolor="#000000" bgcolor="#000099"><div align="center"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">PM Date </font></strong></font></div></td>
          <td width="39" bordercolor="#000000" bgcolor="#000099"><div align="center"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Due Date </font></strong></font></div></td>
          <td width="141" bordercolor="#000000" bgcolor="#000099"><div align="justify"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Comments</font></strong></font></div></td>
          <td width="112" bordercolor="#000000" bgcolor="#000099"><div align="center"><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Added</font></strong></div></td>
          <td width="126" bordercolor="#000000" bgcolor="#000099"><div align="center"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Updated</font></strong></font></div></td>
          <td width="43" bordercolor="#000000" bgcolor="#000099"><div align="center"><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Verify</font></strong></div></td>
        </tr>
        <?php do { ?>
          <tr>
            <td bgcolor="#FFFFFF"><div align="center"><font size="2" face="Geneva, Arial, Helvetica, sans-serif">
              <input name="platform" type="text" value="<?php echo $row_Recordset1['platform']; ?>" size="2" readonly="true">
            </font></div></td>
            <td bgcolor="#FFFFFF"><div align="center"><font size="2" face="Geneva, Arial, Helvetica, sans-serif">
              <input name="fiid" type="text" value="<?php echo $row_Recordset1['fiid']; ?>" size="5" readonly="true">
            </font></div></td>
            <td bgcolor="#FFFFFF"><div align="justify"><font size="2" face="Geneva, Arial, Helvetica, sans-serif"><?php echo $row_Recordset1['fm']; ?></font></div></td>
            <td bgcolor="#FFFFFF"><div align="justify"><font size="2" face="Geneva, Arial, Helvetica, sans-serif">
              <input name="pmdate" type="text" value="<?php echo $row_Recordset1['pmdate']; ?>" size="7" readonly="true">
            </font></div></td>
            <td bgcolor="#FFFFFF"><div align="justify"><font size="2" face="Geneva, Arial, Helvetica, sans-serif">
              <input name="duedate" type="text" value="<?php echo $row_Recordset1['duedate']; ?>" size="7" readonly="true">
            </font></div></td>
            <td bgcolor="#FFFFFF"><div align="justify"><font size="2" face="Geneva, Arial, Helvetica, sans-serif"><?php echo $row_Recordset1['comments']; ?></font></div></td>
            <td bgcolor="#FFFFFF"><div align="justify"><font size="2" face="Geneva, Arial, Helvetica, sans-serif"><?php echo $row_Recordset1['name']; ?></font></div></td>
            <td bgcolor="#FFFFFF"><div align="justify"><font size="2" face="Geneva, Arial, Helvetica, sans-serif"><?php echo $row_Recordset1['updated']; ?></font></div></td>
            <td bgcolor="#FFFFFF">
             
              <div align="center">
                <input <?php if (!(strcmp($row_Recordset1['verify'],1))) {echo "checked=\"checked\"";} ?> <?php if (!(strcmp($row_Recordset1['verify'],"Y"))) {echo "checked=\"checked\"";} ?> name="verify" type="checkbox" id="verify" value="<?php echo $row_Recordset1['verify']; ?>">
            </div></td>
          </tr>
          <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
      </table>
    </div>
    <p align="center"><font color="#FFFFFF">This records are verified by :</font>
      <input name="username" type="text" value="<?php echo ucfirst($row_Recordset2['name']); ?>" size="12" readonly="true">
    </p>
    <p align="center">
      <input type="submit" name="Submit" value="Submit">
    </p>
    <div align="left"> </div>
    <input type="hidden" name="MM_update" value="form1">
  </form>
<?php } // Show if recordset not empty ?>
</body>
</html>
<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);
?>

Link to comment
Share on other sites

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE ict_checklist SET verify=%s, verified=%s WHERE id=%s",
                       GetSQLValueString(isset($_POST['verify']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString($_POST['username'], "text"),
                       GetSQLValueString($_POST['id'], "int"));

 

I think I have problem in this sql command. The 'verify' is checkbox, the id is primary key. So can anyone suggest me the sql command which can support multiple update at once ? Look at the picture one the first post to get the idea how is multiple update i meant..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.