$table="<table border='1'>
<tr>
<th>FIRST NAME</th>
<th>LAST NAME</th>
<th>EMAIL</th>
<th>GENDER</th>".
while($row = mysql_fetch_array($result3))
{
$action="Action";
$var=$action.$count;
."<th>" .$var. "</th>".
$count=$count+1;
}
." </tr>".
while($row = mysql_fetch_array($result2))
{
."<tr>".
"<td>".$row['firstname']."</td>".
"<td>".$row['lastname']."</td>".
"<td>".$row['email']."</td>".
if($row['gender']=='m')
{
$gend='male';
}
else
{
$gend='female';
}
"<td>".$gend."</td>".
$result3=$db->selectUserPermission($uid);
$id=$row['userid'];
$loginuser=$_SESSION['LOGINUSER'];
while($row = mysql_fetch_array($result3))
{
."<td>".
if($row['permid']==1)
{
$permission="VIEW";
$btnid=$id."_VIEW";
."<button id=$btnid name=$btnid onclick='getFunctionView($id)'>".$permission."</button>".
}
else if($row['permid']==2)
{
$permission="EDIT";
$btnid=$id."_EDIT";
."<button id=$btnid name=$btnid onclick='getFunctionEdit($id)';>".$permission."</button>".
}
else if($row['permid']==3)
{
if($id!=1 || $id!=$loginuser)
{
$permission="DELETE";
$btnid=$id."_DELETE";
."<button id=$btnid name=$btnid onclick='getFunctionDelete($id)';>".$permission."</button>".
}
}
else if($row['permid']==4)
{
if($id!=1)
{
$permission="PERMISSION";
$btnid=$id."_PERMISSION";
."<button id=$btnid name=$btnid onclick='getFunctionPermission($id)';>".$permission."</button>".
}
}
else if($row['permid']==5 && $loginuser==$id)
{
$permission="ADD USER";
."<button id=$btnid name=$btnid onclick='location.href=\"adduser.html\"'>".$permission."</button>".
}
else
{
}
."</td>".
}
}
."</tr>
</table>";
echo $table;
This is a code from a php page that is called by ajax.Here $result2 and $result3 are 2 result sets obtained using 2 sql queries.I want generate a table using theese two results and store that table into a php variable $table and in ajax ,i want to assign it directly as a html text,ajax code is shown below.
$(document).ready(function(){
var temp='getUser';
$.ajax ({
type:'GET',
url: 'listdetails.php',
data:{ud:temp},
success:function(data)
{
document.getElementByID("userList").innerHTML=data;
}
});
});
And my problem is in creating php variable $table.It is showing error in every concatination( "." ).this is the error message "Parse error: syntax error, unexpected T_WHILE in C:\wamp\www\listdetails.php on line 39".Can any one suggest a good method for making php variable $table.and remember that this $table is in php page called by ajax.