Hi all

I have a page which diisplays a customers information. Within this page is a layer contining a repeat region table from a sub / child table. I want any fields within this sub/child table to be updated, by the easiest method.

Currently, I have a link above this child table, which passes the "customerID" by URL parm. This is the update page. On this page I have displayed the child table table for that customerID, using again a repeat region to display all records, so the user can choose which field on which record the wish to update (I have selected a column for primary key). I have added an "update server behaviour" to this repeat region.

What happens is that this page will only update the last record within the table.

Can anyone help please?
(I'm assuming this is not Dreamweaver specific)

Thanks

    Brian,

    Ow, my head hurts. Too many words, not enough code ;-) Ok, kidding around, but you might want to post a bit of the code that is clearly buggy.

    One debugging tip now: in your PHP, instead of sending the SQL commands to the server, echo them to the screen. So you can see exactly what's going on.

    Check out my "cardinal rules" in my sig for more tips.

    best
    Eric

      Hi Eric

      Here is my code below for the Update page:

      // in the head section:

      <?php require_once('Connections/connDiamond.php'); ?>
      <?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 = $HTTP_SERVER_VARS['PHP_SELF'];
      if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
      $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
      }

      if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "UpdExch")) {
      $updateSQL = sprintf("UPDATE linedetails SET CustomerID=%s, Quantity1=%s, Usage=%s, ISDN2=%s, LineProvider=%s WHERE Exchange=%s",
      GetSQLValueString($HTTP_POST_VARS['hiddenField'], "int"),
      GetSQLValueString($HTTP_POST_VARS['qty'], "int"),
      GetSQLValueString($HTTP_POST_VARS['usage'], "text"),
      GetSQLValueString($HTTP_POST_VARS['isdn2'], "int"),
      GetSQLValueString($HTTP_POST_VARS['lineprov'], "text"),
      GetSQLValueString($HTTP_POST_VARS['exchange'], "text"));

      mysql_select_db($database_connDiamond, $connDiamond);
      $Result1 = mysql_query($updateSQL, $connDiamond) or die(mysql_error());

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

      $colname_RSexhchange = "1";
      if (isset($HTTP_GET_VARS['CustomerID'])) {
      $colname_RSexhchange = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['CustomerID'] : addslashes($HTTP_GET_VARS['CustomerID']);
      }
      mysql_select_db($database_connDiamond, $connDiamond);
      $query_RSexhchange = sprintf("SELECT * FROM linedetails WHERE CustomerID = %s", $colname_RSexhchange);
      $RSexhchange = mysql_query($query_RSexhchange, $connDiamond) or die(mysql_error());
      $row_RSexhchange = mysql_fetch_assoc($RSexhchange);
      $totalRows_RSexhchange = mysql_num_rows($RSexhchange);
      </head>

      // in the body section:

      <form action="<?php echo $editFormAction; ?>" method="POST" name="UpdExch" id="UpdExch">
      <p>Company: </p>
      <p>
      <input name="hiddenField" type="hidden" value="<?php echo $row_RSexhchange['CustomerID']; ?>">
      </p>
      <p><?php echo $row_RSexhchange['CustomerID']; ?> </p>
      <table width="619" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
      <tr bgcolor="#0066CC">
      <td width="132"> <p align="center"><strong><font color="#FFFFFF">Exchange</font></strong></p></td>
      <td width="70"> <p align="center"><strong><font color="#FFFFFF">Qty</font></strong></p></td>
      <td width="176"> <p align="center"><strong><font color="#FFFFFF">Usage</font></strong></p></td>
      <td width="51"> <p align="center"><strong><font color="#FFFFFF">ISDN</font></strong></p></td>
      <td width="75"> <p align="center"><strong><font color="#FFFFFF">LineProvider</font></strong></p></td>
      </tr>
      <?php do { ?>
      <tr>
      <td>
      <p align="center">
      <input name="exchange" type="text" id="exchange" value="<?php echo $row_RSexhchange['Exchange']; ?>">
      </p></td>
      <td><p align="center">
      <input name="qty" type="text" id="qty" value="<?php echo $row_RSexhchange['Quantity1']; ?>" size="3">
      </p></td>
      <td><p align="center">
      <input name="usage" type="text" id="usage" value="<?php echo $row_RSexhchange['Usage']; ?>">
      </p></td>
      <td><p align="center">
      <input name="isdn2" type="text" id="isdn2" value="<?php echo $row_RSexhchange['ISDN2']; ?>" size="5">
      </p></td>
      <td><p align="center">
      <input name="lineprov" type="text" id="lineprov" value="<?php echo $row_RSexhchange['LineProvider']; ?>">
      </p></td>
      </tr>
      <?php } while ($row_RSexhchange = mysql_fetch_assoc($RSexhchange)); ?>
      </table>
      <p>
      <input name="Update" type="submit" id="Update" value="Update">
      </p>
      <p>&nbsp; </p>
      <input type="hidden" name="MM_update" value="UpdExch">
      </form>

      </body>

      I suppose now you are going to say - TOO much code?

      Thanks for any help you can give.
      Brian

        Write a Reply...