Hi,
I always got this error on my while list…
Can anyone help with this…Really appreciate your hel
<?php
session_start();
include_once("conn.php");
if(isset( $_SESSION['username'])){
$tick=$_GET['idno'];
$new=mssql_fetch_assoc(mssql_query("Select * from tblTicket inner join tblAttachment
on tblTicket.TickNo=tblattachment.TicketNo inner join tblAssign on tblTicket.TickNo=tblAssign.TicketNo where tblTicket.TickNo='$tick'"));
$img1=trim($new['image1']);
$img2=trim($new['image2']);
$img3=trim($new['image3']);
?>
<!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" xml:lang="en-us">
<head>
<link href="css/mystyle.css" rel="stylesheet" type="text/css"/>
<script src="jquery\\jquery.min.js"></script>
<script type="text/javascript" src="jquery\\jquery.validate.js"></script>
<script>
function textCounter(field, countfield, maxlimit)
{
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}
function textcount(field,mlimit)
{
field.value = field.value.substring(0, mlimit);
}
</script>
<script>
$(document).ready(function(){
$("#newticket").validate({
rules: {
msg:"required"
}
});
});
</script>
</head>
<body onload="document.newticket.msg.focus();">
<?php
if(isset($_POST['Save'])){
$ran=rand();
while(list($key,$value) = each($_FILES["images"]["name"])){
if (($_FILES["images"]["size"][$key]))
{
$filename = $value;
$add = "upload/$filename";
$imagename=($_FILES['images']['name'][$key]);
$original_name=$filename;
if(!empty($value))
{
while(file_exists($add)){
$filename = rand().$original_name;
$add = "upload/".$filename;
}
if(copy($_FILES[images][tmp_name][$key],$add)){
chmod("$add",0777);
}
$i = $i+1;
$img[$i]=$filename;
}
}
}
$image1=trim($img[1]);
$image2=trim($img[2]);
$image3=trim($img[3]);
$msg=addslashes($_POST['msg']);
mssql_query("sp_post @tick='$_POST[id]',@msgby='$_SESSION[username]',@msg='".str_replace("'","''",$msg)."'");
mssql_query("sp_uploadfile @tickno='$_POST[id]',@createby='$_SESSION[username]',@createto='$new[UserName]',@img1='$image1',@img2='$image2',@img3='$image3'");
}
$usermsg=mssql_query("Select * from tblForum where TicketNo='$tick' order by Date desc");
?>
<br/>
<p>
<table border=1 bgcolor="white" width="100%" >
<tr>
<td width="100%" align="left" valign="middle">
<img src='img/ticketprofile.png'>
</td>
</tr>
<tr>
<td width="100%" align="left" >
<table align='center'>
<tr>
<td ><b>Ticket Number : </b><?php echo $new['TickNo']; ?></td>
</tr>
<tr>
<td ><b>Create By : </b><?php echo $new['UserName'];?> </td>
<td ><b>Assign to : </b><?php echo $_SESSION['username'];?></td>
</tr>
<tr>
<td ><strong>Department : </strong><?php echo $new['Dept'];?> </td>
<td><strong>Email : </strong><?php echo $new['Email'];?></td>
</tr>
<tr>
<td ><strong>Date create : </strong><?php echo $new['DateCreate']." ".$new['TimeCreate'] ;?> </td>
<td><strong>Date Assign : </strong><?php echo $new['DateAssign'];?></td>
</tr>
<tr>
<td><strong>Category : </strong><?php echo $new['Category'];?> </td>
<td ><strong>Sub-Category : </strong><?php echo $new['Subcat'];?></td>
</tr>
<tr>
<td><strong>Description : </strong><?php echo $new['Description'];?></td>
</tr>
<tr>
<td><strong>File Attach : </strong>
<?php
if(!empty($img1))
{
echo "<a href='DLfile.php?download_file=$new[image1]'>File 1</a>  ";
}
if(!empty($img2))
{
echo "<a href='DLfile.php?download_file=$new[image2]'>File 2</a>  ";
}
if(!empty($img3))
{
echo "<a href='DLfile.php?download_file=$new[image3]'>File 3</a>  ";
}
?>
</td>
</tr>
<tr>
<td align='left'>
<a href="#" onclick="document.getElementById('showattach').style.display=(document.getElementById('showattach').style.display== 'block')?'none':'block';">Attach a File</a>
</td>
</tr>
<tr>
<td align='left'>
<div align='left' name='showattach' id='showattach' class='showattach' style="display: none">
<input align='left' type='file' name='images[]'><br/>
<input align='left' type='file' name='images[]' ><br/>
<input align='left' type='file' name='images[]'>
</div>
</td>
</tr>
</table>
</td>
</tr>
</p>
</table>
<table align='center' width='70%' >
<?php while($row1=mssql_fetch_array($usermsg)){
?>
<tr align='left'>
<td><?php echo "<font color='#ff0000' size='2'>".$row1['Date']."</font> "?></td>
</tr>
<tr align='left'>
<td><b><?php echo $row1['MessageBy'].":";?></b>
<font color='#15317E'><?php echo $row1['Message'];?></font></td>
</tr>
<td><hr width='100%'></td>
<?php
}
?>
</table>
<form name='newticket' id='newticket' action='<?php $_SERVER['PHP_SELF'];?>' method='post' enctype="multipart/form-data">
<input type='hidden' name='id' value='<?php echo $tick;?>'>
<table id='msgbox' name='msgbox' class='msgbox' align='center' style='table-layout:fixed'>
<col width=67>
<col width=75>
<col width=41>
<td align='left'valign=top><b>Message :</td>
<tr>
<td align='left'><textarea rows="10" cols="54" name="msg" wrap=physical onKeyDown="textCounter(this.form.msg,this.form.remLen,500);" onKeyUp="textCounter(this.form.msg,this.form.remLen,500);">
</textarea>
<br><input readonly type=text name=remLen size=3 maxlength=3 value="500"> characters left.</font></td>
</tr>
<tr>
<tr>
<td align='left'>
<input type='submit' value='Submit' name='Save' onClick="javascript: var x=window.confirm('Send this message?');if (!x) return(false);">
<input type='Reset' value='Reset' name='reset'>
</td>
</tr>
</table>
</form>
</body>
</html>
<?php
}else{ //not logged in
header('location: login.php');
}
?>