Document creation

hi friends i have created word document in php it’s working perfectly… if i have using any mysql select query it’s not working please any one help…
this is my code…

<?php
/*

  • Created on Jul 23, 2011
  • To change the template for this generated file go to
  • Window - Preferences - PHPeclipse - PHP - Code Templates
    */
    header(“Content-Type: application/msword”);
    header(“Content-Disposition: attachment; filename=\“file.doc\””);
    $gradeid =$_GET[‘gradeid’];
    $school_id=$_GET[‘schoolid’];
    $student_id =$_GET[‘studentid’];
    $orderdate=$_GET[‘orderdate’];

$query = “SELECT * FROM jos_jwd_parent_order WHERE orderdate=‘$orderdate’ AND school_id=$school_id ORDER BY grade”;
$res = mysql_query($query);

$tbl .= ‘<html>’;
$tbl .= ‘<meta http-equiv=\“Content-Type\” content=\“text/html; charset=Windows-1252\”>’;
$tbl .= ‘<body>’;
//echo '<div id=“mainid” style=“background:#044105;width:300px;padding:0 auto;border:1px solid #000000;”/>
//echo '<div class=“main” style=“background:#FFFFFF;width:300px;margin:0px;padding:0px;”><center><br/>
$tbl .= ‘<table width=“300px” border=“0” cellpadding=“0” cellspacing=“0” class=“menuhead2”>’;
$tbl .= ‘<tr>’;
$tbl .= ‘<td align=“left” valign=“top” style=“height:50px”>’;

$i=0;
while($row = mysql_fetch_assoc($res))
{
$i=$i+1;
//Retrive grade name
$gradeids =$row[‘grade’];
$query1 = “SELECT gradename FROM jos_school WHERE schoolid=$school_id AND id=$gradeids”;
$res1 = mysql_query($query1);
$row1 = mysql_fetch_assoc($res1);

//Retrive Student Name
$studentids=$row[‘student_id’];
$query2 = “SELECT lname,fname FROM jos_student WHERE id=”.$studentids;
$res2 = mysql_query($query2);
$count = mysql_num_rows($res2);
$row2 = mysql_fetch_assoc($res2);

//Retrive the ordered food items

$query3 = “SELECT * FROM jos_jwd_parent_orderdetails WHERE foodtype=‘fooditem’ AND grade=‘$gradeids’ AND quantity!=‘’ AND school_id=‘$school_id’ AND orderdate=‘$orderdate’ AND student_id=”.$studentids;
$res3 = mysql_query($query3);

//Retrive the ordered beverage items
$query4 = “SELECT * FROM jos_jwd_parent_orderdetails WHERE foodtype=‘beverageitem’ AND grade=‘$gradeids’ AND quantity!=‘’ AND school_id=‘$school_id’ AND orderdate=‘$orderdate’ AND student_id=”.$studentids;
$res4 = mysql_query($query4);

//Retrive Snacks item
$query5 = “SELECT * FROM jos_jwd_parent_orderdetails WHERE foodtype=‘snackitem’ AND grade=‘$gradeids’ AND quantity!=‘’ AND school_id=‘$school_id’ AND orderdate=‘$orderdate’ AND student_id=”.$studentids;
$res5 = mysql_query($query5);

$tbl .= ‘<div style=“float:left;width:165px; height:55px; margin:17.5px 17.5px 17.5px 17.5px; padding-left:70px;overflow:hidden;border:1px solid #000000;”>’;
$tbl .= ‘<table border=“0” width=“100%” style=“height:50px” cellpadding=“0” cellspacing=“0”>’;
$tbl .= ‘<tr border=“0” >’;

$tbl .= ‘<td valign=“top” style=“height:50px” align=“left”>’;
$tbl .= ‘<center><b>’.$row1[‘gradename’].‘</b></center><br/>’;

$tbl .= ‘<center><b>                         ‘.$row2[‘fname’].$row2[‘lname’].’</b><br/>’;

while($row3 = mysql_fetch_assoc($res3))
{

$tbl .= ‘<center>’.$row3[‘fooditem’].‘-’.$row3[‘quantity’].‘<center><br/>’;

}
while($row4 = mysql_fetch_assoc($res4))
{

$tbl .= ‘<center>’.$row4[‘fooditem’].‘-’.$row4[‘quantity’].‘</center><br/>’;

}
while($row5 = mysql_fetch_assoc($res5))
{
$tbl .= ‘<center>’.$row5[‘fooditem’].‘-’.$row5[‘quantity’].‘</center><br/>’;
}
$tbl .= ‘</td>’;
$tbl .= ‘<td valign=“top” align=“right” width=“75px” style=“height:50px”>’;
$tbl .= ‘<br/></td>’;
$tbl .= ‘</tr>’;
$tbl .= ‘</table>’;
$tbl .= ‘</div>’;

if($i%10==0)
{
$tbl .= ‘<div style=“width:300px;color:#FFFFFF;”><br/><br/><br/>Healthy Hunger<br/><br/><br/></div>’;
}
else
{

}
}
$tbl .= ‘</td>’;
$tbl .= ‘</tr>’;

$tbl .= ‘</table>’;
$tbl .= ‘</center>’;
$tbl .= “</body>”;
$tbl .= “</html>”;
echo $tbl;
?>

And you want us to help how? Imagine what the people reading your post are thinking… we’ve got a lump of code we can’t run, no error messages, no description of how the code fails, no way to debug it…