Hi,
okay im new to coding and got thrown in by my manager straight into .php without even looking at basic..
I have included my coding for a standalone webpage that is to be placed onto the IT systems purely to disect the php helpdesk ticket system and display the results as needed in a dynamic table.
how do i get the page to only display the results from the date range and then sort it by the drop down menu based purley on the "updated" data range in the table which is the date the tickets was closed???
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style2 {
font-size: 36px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style4 {font-weight: bold}
.style6 {font-weight: bold}
-->
</style>
<
</head>
<?php require_once('Connections/helpdesk.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;
}
}
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_helpdesk, $helpdesk);
$query_Recordset1 = "SELECT admin_user, `update`, status, opened, `group` FROM phpdesk_tickets ORDER BY `update` ASC";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $helpdesk) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
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;
}
}
mysql_select_db($database_helpdesk, $helpdesk);
$query_Recordset1 = "SELECT admin_user, `update`, status, opened, `group` FROM phpdesk_tickets ORDER BY `update` ASC";
$Recordset1 = mysql_query($query_Recordset1, $helpdesk) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<body>
<div align="center">
<p><img src="images/helpdesk.jpg" width="318" height="74" /></p>
<p class="style2">STATISTICS</p>
</div>
<div align="center"></div>
<div align="center"></div>
<p align="center"><strong>SELECT DATE RANGE TO SEARCH WITHIN.</strong></p>
<form id="form3" name="form3" method="post" action="">
<label>
<div align="center"><strong>STARTING :
<input name="START" type="text" id="START" value="<?php echo $row_Recordset1['update']; ?>" />
</strong><strong>ENDING : </strong>
<input name="END" type="text" id="END" value="<?php echo $row_Recordset1['update']; ?>" />
<div align="center"></div>
<label> </label>
</div>
</label>
<div align="center">
<input type="submit" name="SEARCH" id="SEARCH" value="Submit" />
</div>
<div align="center"></div>
<label>
<div align="center"></div>
<div align="center"></div>
<div align="center"></div>
</label>
<span id="spryselect1">
<label>
<div align="center"><span id="spryselect1">
<select name="SORT" id="SORT">
<option value="admin_user" <?php if (!(strcmp("admin_user", $row_Recordset1['']))) {echo "selected=\"selected\"";} ?>>ADMIN_USER</option>
<option value="status" <?php if (!(strcmp("status", $row_Recordset1['']))) {echo "selected=\"selected\"";} ?>>STATUS</option>
<option value="update" <?php if (!(strcmp("update", $row_Recordset1['']))) {echo "selected=\"selected\"";} ?>>UPDATE</option>
<option value="opened" <?php if (!(strcmp("opened", $row_Recordset1['']))) {echo "selected=\"selected\"";} ?>>OPENED</option>
<option value="group" <?php if (!(strcmp("group", $row_Recordset1['']))) {echo "selected=\"selected\"";} ?>>GROUP</option>
</select>
</span>
<p> </p>
</div>
<div align="center"><span id="spryselect1">
</label>
</span>
</div>
<table border="1" align="center">
<tr>
<td><span id="spryselect1">admin_user</span></td>
<td><span id="spryselect1">update</span></td>
<td><span id="spryselect1">status</span></td>
<td><span id="spryselect1">opened</span></td>
<td><span id="spryselect1">group</span></td>
</tr>
<?php do { ?>
<tr>
<td><span id="spryselect1"><?php echo $row_Recordset1['admin_user']; ?></span></td>
<td><span id="spryselect1"><?php echo $row_Recordset1['update']; ?></span></td>
<td><span id="spryselect1"><?php echo $row_Recordset1['status']; ?></span></td>
<td><span id="spryselect1"><?php echo $row_Recordset1['opened']; ?></span></td>
<td><span id="spryselect1"><?php echo $row_Recordset1['group']; ?></span></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<div align="center"></div>
<div align="center"></div>
</form>
<p align="center"> </p>
<script type="text/javascript">
<!--
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
//-->
</script>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($Recordset1);
mysql_free_result($Recordset1);
?>