0

Hi

I have created a new Recordset which uses the ConveyorNumber to display information relating to a particular conveyor. The recordset should use this from the conveyornumber field on a prevoius page so when history is clicked the hostory of that one conveyor will appear.

I have added a Dynamic table to my history page just to show the data for now.

When i test my recordset in 'bindings' in dreamweaver, its brings up a test value box which is i enter a conveyornumber into the box it displays the conveyor history which is fine, but obviously i dont want a message box to appear like that when running the query properly as it should use the conveyor number from prevoius page. But when i run my history page i cant get the data to display in the dynamic table.

any ideas?

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}



$maxRows_ConveyorHistory = 1;
$pageNum_ConveyorHistory = 0;
if (isset($_GET['pageNum_ConveyorHistory'])) {
  $pageNum_ConveyorHistory = $_GET['pageNum_ConveyorHistory'];
}
$startRow_ConveyorHistory = $pageNum_ConveyorHistory * $maxRows_ConveyorHistory;

$colname_ConveyorHistory = "-1";
if (isset($_POST['ConveyorNumber'])) {
  $colname_ConveyorHistory = $_POST['ConveyorNumber'];
}
mysql_select_db($database_Database_Connection, $Database_Connection);
$query_ConveyorHistory = sprintf("SELECT * FROM conveyor_number WHERE ConveyorNumber = %s", GetSQLValueString($colname_ConveyorHistory, "text"));
$query_limit_ConveyorHistory = sprintf("%s LIMIT %d, %d", $query_ConveyorHistory, $startRow_ConveyorHistory, $maxRows_ConveyorHistory);
$ConveyorHistory = mysql_query($query_limit_ConveyorHistory, $Database_Connection) or die(mysql_error());
$row_ConveyorHistory = mysql_fetch_assoc($ConveyorHistory);

if (isset($_GET['totalRows_ConveyorHistory'])) {
  $totalRows_ConveyorHistory = $_GET['totalRows_ConveyorHistory'];
} else {
  $all_ConveyorHistory = mysql_query($query_ConveyorHistory);
  $totalRows_ConveyorHistory = mysql_num_rows($all_ConveyorHistory);
}
$totalPages_ConveyorHistory = ceil($totalRows_ConveyorHistory/$maxRows_ConveyorHistory)-1;



?>

<body>

<form action="<?php echo $editFormAction; ?>" method="GET" name="form2" id="form2">
  <table align="center">
  <tr valign="baseline">
      <td nowrap="nowrap" align="right">Date:</td>
      <td><input type="text" name="Date" value="<?php echo $row_ConveyorHistory['Date']; ?>" readonly="readonly"/></td>
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Conveyor Number:</td>
      <td><input type="text" name="Conveyor Number" value="<?php echo $row_ConveyorHistory['Conveyor Number']; ?>" readonly="readonly" /> </td>
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Asset Type:</td>
      <td><input type="text" name="AssetType" value="<?php echo $row_ConveyorHistory['AssetType']; ?>" readonly="readonly"/></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Motor Temperature:</td>
      <td><input type="text" name="Motor_Temperature" value="<?php echo $row_ConveyorHistory['Motor Temperature']; ?>" readonly="readonly"/></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Motor Frame:</td>
      <td><input type="text" name="Motor_Frame" value="<?php echo $row_ConveyorHistory['Motor Frame']; ?>" size="32" readonly="readonly"/></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">&nbsp;</td>
      <td> <input type="submit" name="Previous" id="Previous" value="Previous" />
          <input type="submit" name="Next" id="Next" value="Next" />
      </td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <table border="1">
    <tr>
      <td>ConveyorNumber</td>
      <td>AssetType</td>
      <td>Motor Temperature</td>
      <td>Motor Frame</td>
      <td>Date</td>
    </tr>
    <?php do { ?>
      <tr>
        <td><?php echo $row_ConveyorHistory['ConveyorNumber']; ?></td>
        <td><?php echo $row_ConveyorHistory['AssetType']; ?></td>
        <td><?php echo $row_ConveyorHistory['Motor Temperature']; ?></td>
        <td><?php echo $row_ConveyorHistory['Motor Frame']; ?></td>
        <td><?php echo $row_ConveyorHistory['Date']; ?></td>
      </tr>
      <?php } while ($row_ConveyorHistory = mysql_fetch_assoc($ConveyorHistory)); ?>
  </table>
<p>
    <input type="hidden" name="MM_update" value="form2" />
  </p>
</form>
<p><label><input name="back" type="submit"  value="Back" onclick="location.href='layout.php'"/></label></p>


</body>
</html>
<?php

mysql_free_result($ConveyorHistory);

?>

Edited by Nick Evan: Added CODE tags

4
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by Nick Evan
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.