Hello Gurus what is wrong with this code it works the first time then when i build the header again an error occurs saying From is undefined
Jquery
function sort(tableHeader,sortDir)
{
$.ajax({
url: "sort.php",
type:"get",
data: "tableHeader="+tableHeader +"&sortdirection="+sortDir,
success:function(data){
$("#t1").html(data);}});}
php
$table_Header=$_GET['tableHeader'];
$sort_Dir=$_GET['sortDir'];
if ($table_Header == 'From')
{
$sort_By = 'player_name';
}
else if ($table_Header == 'To')
{
$sort_By = 'player_name';
}
else if ($table_Header== 'Gr')
{
$sort_By = 'grp_abr';
}
if (isset($sort_Dir) && $sort_Dir == 'DESC')
{
$sort_Dir = 'DESC';
}
else
{
$sort_Dir = 'ASC';
}
$str = stripslashes('From');
echo $sortBy;
$result = mysql_query("SELECT * FROM messages,Player
where player_id = from_user
ORDER BY player_name ".$sort_Dir);
echo "<thead>
<tr>
<th style='color:royalblue;'>•</th>
<th align='center'>Time</th>
<th align='left' onClick='sort('From',$sort_Dir);'>De:</th>
<th align='left'>To:</th>
<th align='left'>Gr</th>
</tr>
</thead> ";
while($row = mysql_fetch_array($result))
{
echo "<tbody>
<tr class='highlight'>
<td width='30' align='center' style='color:royalblue'>"."•"."</td>
<td width='70' align='left'>".$row["Time_Date"]."</td>
<td width='600' align='left'>".$row["player_name"]."</td>
<td width='600' align='left'></td>
<td width='100' align='left'></td>
<tr class='highlight'>
<td></td>
<td colspan='4'>".$row["msg_desc"]."</td></tr>
</tbody>";
}
I need urgent help Thanks in advance