- Joined
- Jun 11, 2018
- Messages
- 1
- Reaction score
- 0
Hi all,
I am trying to get multiple rows data which has same id. So the same id can be allocated to different entries and I need to display this.
The code as follows:
Any help appreciated
I am trying to get multiple rows data which has same id. So the same id can be allocated to different entries and I need to display this.
The code as follows:
<?php require_once('Connections/eam.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
$colname_rsMaintenanceAsset = "-1";
if (isset($_GET['recordID'])) {
$colname_rsMaintenanceAsset = $_GET['recordID'];
}
mysql_select_db($database_eam, $eam);
$query_rsMaintenanceAsset = sprintf("SELECT * FROM maintenance_history WHERE maint_id = %s", GetSQLValueString($colname_rsMaintenanceAsset, "int"));
$rsMaintenanceAsset = mysql_query($query_rsMaintenanceAsset, $eam) or die(mysql_error());
$row_rsMaintenanceAsset = mysql_fetch_assoc($rsMaintenanceAsset);
$totalRows_rsMaintenanceAsset = mysql_num_rows($rsMaintenanceAsset);
}
$pageTitle="Maintenance History"; ?>
<?php include('includes/header.php'); ?>
<h3>Maintenance history for Asset ID: <?php echo $colname_rsMaintenanceAsset; ?></h3>
<table class="table1">
<tr>
<th>Maintenance ID</th>
<th>Date Completed</th>
<th>By</th>
<th>Checklist</th>
<th>Comments</th>
<th>SPARE</th>
<th>View </th>
</tr>
<?php do { ?>
<tr onmouseover="this.bgColor='#F2F7FF'" onmouseout="this.bgColor='#FFFFFF'";>
<td> <?php echo $row_rsMaintenanceAsset['id']; ?> </td>
<td> <?php echo $row_rsMaintenanceAsset['date_completed']; ?> </td>
<td> <?php echo $row_rsMaintenanceAsset['by_staff']; ?> </td>
<td> <?php echo $row_rsMaintenanceAsset['maint_checklist']; ?> </td>
<td> <?php echo $row_rsMaintenanceAsset['maint_comm']; ?> </td>
<td> <?php echo $row_rsMaintenanceAsset['status']; ?> </td>
<td> <a href="HardwareDetail.php?recordID=<?php echo $row_rsMaintenanceAssets['maint_id']; ?>">View</a></td>
</tr>
<?php } while ($row_rsMaintenanceAssets = mysql_fetch_assoc($rsMaintenanceAssets)); ?>
</table>
Any help appreciated