0

hi,
in the below code i have made a variable $htmll, in my php file.In dat var i have stored the html code,in dat html code im writing some php code which in unable to execute....Kindly help me out to resolve it.
Thanx....

<?php
 $htmll='
 <table align="centre" border="1" cellpadding="0" cellspacing="0" bgcolor="#E3EEB7" style="font-size:10px; font-faimly:vardana;">
  <tr>
    <td width="19" bgcolor="#B7C6B0">Inp</td>
    <td width="19" bgcolor="#B7C6B0">Pre</td>
    <td width="24" bgcolor="#B7C6B0">Lea </td>
    <td width="21" bgcolor="#B7C6B0">Abs</td>
    <td width="34" bgcolor="#B7C6B0">%Age</td>
    
  </tr>'.
  while($attnobj=@mysql_fetch_object($result))//this while is not working.im getting the parser error.
  {
		$off17_inp	=	$attnobj->off17_inp;
		$off17_pre	=	$attnobj->off17_pre;
		$off17_lea	=	$attnobj->off17_lea;
		$off17_abs	=	$attnobj->off17_abs;
		
		.'
  
  <tr>
    <td>&nbsp;</td>
    <td>'.$ftysecname.'</td>
    <td>'.$off17_inp.'</td>
    <td>'.$off17_pre.'</td>
    <td>'.$off17_lea.'</td>
    <td>'.$off17_abs.'</td>
    
  </tr> '.}.'
  
</table>';
?>
3
Contributors
8
Replies
10
Views
7 Years
Discussion Span
Last Post by diafol
0

check whether you got the $result by echo the part. and mention the parse error what you get?

Edited by rajarajan07: n/a

0

Parse error: parse error in C:\wamp\www\attendance\report.php on line 12
there is no echo part in $result

0

Thats why I want you to check that. you used $result in while loop, insert a statement before while loop

echo $result;

0

Parse error: parse error in C:\wamp\www\attendance\report.php on line 12
there is no echo part in $result

0

actually its like this
$result = $attendanceDAO->getreportattendance($date,$shift);
// i have call it above the varable $htmll
i have echoed the $result and im geting the values if i use while out of $htmll but getting parser error if i use while inside the $htmll

0

You are concatenating string - loop - string.
Place this before the html variable:

//do your DB object here
$trows="";
while($attnobj=@mysql_fetch_object($result)){
		$off17_inp	=	$attnobj->off17_inp;
		$off17_pre	=	$attnobj->off17_pre;
		$off17_lea	=	$attnobj->off17_lea;
		$off17_abs	=	$attnobj->off17_abs;
 
$trows .= "<tr>
    <td>&nbsp;</td>
    <td>$ftysecname</td>
    <td>$off17_inp</td>
    <td>$off17_pre</td>
    <td>$off17_lea</td>
    <td>$off17_abs</td>
 
  </tr>";
}

$htmll='
 <table align="centre" border="1" cellpadding="0" cellspacing="0" bgcolor="#E3EEB7" style="font-size:10px; font-faimly:vardana;">
  <tr>
    <td width="19" bgcolor="#B7C6B0">Inp</td>
    <td width="19" bgcolor="#B7C6B0">Pre</td>
    <td width="24" bgcolor="#B7C6B0">Lea </td>
    <td width="21" bgcolor="#B7C6B0">Abs</td>
    <td width="34" bgcolor="#B7C6B0">%Age</td>
 
  </tr>' . $trows . '</table>';

BTW: formatting your html in php woun't beautify your html. You can use heredoc or \n and \t to do this.

Edited by diafol: n/a

0

thanku so much
well i know it woudn beautify ma html but its the requirment ov ma code
anyay thnx fo ya help:)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.