how to use sql query result in html table - php

I am trying to create a html table showing results from php sql query. it is a result page of students php code is as under
$r1=$_GET["r"];
$con=mysqli_connect(localhost,chumspai_tlss,Tls121,chumspai_tlsResult);
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM nursery_blue_ WHERE sr_='$r1'");
while($row = mysqli_fetch_array($result))
{
html code is
<pre>
<form name="frmResult" id="frmResult" action="" method="post" onsubmit="return checkEmpty();">
<table width="80%" cellpadding="5" cellspacing="5" border="0">
<tr>
<td class="heading noborder">Enter Your Roll Number:</td>
<td class="noborder"><input type="text" id="r" name="r" value="" /></td>
</tr>
<tr>
<!--
<td class="heading noborder">Enter Your Name:</td>
<td class="noborder"><input type="text" id="name" name="name" value="" /></td>
</tr>
<tr>
<td class="heading noborder">Search by</td>
<td class="noborder"><input type="radio" id="option" name="option" value="rno" checked="checked" />
Roll No
<input type="radio" id="option" name="option" value="name" />
Name </td>
</tr>
-->
<tr>
<td class="noborder"> </td>
<td class="noborder"><input type="submit" name="submit" value="Search" />
<input type="reset" name="reset" value="Clear" />
</td>
</tr>
<!--<tr>
<td colspan="2"> <embed src="images/wait.swf"></embed></td>
</tr> -->
</table>
</form>
<div style="border:1px solid #000000;">
<table width="100%" cellpadding="10" cellspacing="0" border="0">
<tr>
<td class="heading grey" width="30%">RNO</td>
<td><?php
Print $row['sr_'];
?>
</td>
</tr>
<tr>
<td class="heading grey">NAME</td>
<td class="shade"></td>
</tr>
<tr>
<td class="heading grey">FATHER</td>
<td></td>
</tr>
<tr>
<td class="heading grey">regno</td>
<td></td>
</tr>
</table>
<table width="100%" cellpadding="10" cellspacing="0" border="0">
<tr class="grey">
<td rowspan="2" class="heading">Sr.no </td>
<td rowspan="2" class="heading">Name of subject </td>
<td rowspan="2" class="heading">Maximum Marks</td>
<td colspan="7" class="heading">detail of marks Obtained</td>
<tr class="grey">
<td class="heading">PART ONE</td>
<td class="heading">Total</td>
</tr>
<tr>
<td>1</td>
<td>Urdu</td>
<td></td>
<td> </td>
<td></td>
</tr>
<tr class="shade">
<td>2</td>
<td>English</td>
<td></td>
<td> </td>
<td></td>
</tr>
<tr>
<td>3</td>
<td>Islamyat</td>
<td></td>
<td> </td>
<td></td>
</tr>
<tr class="shade">
<td>4</td>
<td>pakstudies</td>
<td></td>
<td> </td>
<td></td>
</tr>
<tr class="shade">
<td>6</td>
<td></td>
<td></td>
<td></td>
<td>0</td>
</tr>
<tr>
<td>7</td>
<td></td>
<td></td>
<td></td>
<td>0</td>
</tr>
<tr class="shade">
<td>8</td>
<td></td>
<td></td>
<td></td>
<td>0</td>
</tr>
<tr class="shade">
<td>9</td>
<td></td>
<td></td>
<td></td>
<td>0</td>
</tr>
<tr class="grey">
<td colspan="2" class="heading">TOTAL</td>
<td class="heading">1100</td>
<td colspan="4" class="heading"></td>
</tr>
<tr class="grey">
<td colspan="3" class="heading">NOTIFICATION</td>
<td class="heading"></td>
<td class="heading"></td>
<td colspan="2" class="heading"></td>
</tr>
<tr>
<td colspan="7">(i) This provisional result intimation is issued as a notice only. Errors and omissions are excepted.</td>
</tr>
</table>
</pre>
please help me how to embed this php query with this html table and html form also.

you are not so far.
The variable $row is an array containing your data. Try this to see it's structure in your while call:
print_r($row);
Using this command you will see the name of each item of your array. Note it somewhere. Then you can do something like this:
...<td><?php echo $row['desired_column_name']; ?></td>...
If you receive data from your mysql query, this should do the trick.
Hope it helps,
Paul

Try This :
$result = mysql_query("select * from emp");
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td id=SrNo$cnt >".$row['eno']."</td>";
echo "<td id=ItemId$cnt >".$row['eId']."</td>";
echo "<td>". "<button name='Update' id='update' onclick='show(".$cnt.")'>UPDATE</button>"."</td>";
echo "<td>". "<button name='Report' id='show' onclick='Report(".$row['SrNo'].")'>REPORT</button>"."</td>";
echo "</tr>";
echo "<div id=show$cnt>";
echo "</div>";
$cnt++;
}

Related

Automatically New Pages Created in HTML2PDF

I am using HTml2pdf library to convert HTML to PDF.
Below is the code i am using.
PHP
require __DIR__.'/vendor/autoload.php';
use Spipu\Html2Pdf\Html2Pdf;
$html2pdf = new Html2Pdf();
$html2pdf = new HTML2PDF('P', 'A4', 'en');
$html2pdf->setTestTdInOnePage(false);
$html = file_get_contents('index.html');
$html2pdf->writeHTML($html);
$html2pdf->output();
HTML
<div class="bap">
<div class="row">
<div class="par_col">
<div class="column">
<img src="b.jpg" alt="test">
<table style="width:99%" class="feetop">
<tr>
<td class="t_head">Challan No.</td>
<td class="lii undl">18584</td>
<td class="t_heada">Due Date:</td>
<td class="liia undl"></td>
</tr>
<tr>
<td class="t_head_c">Name</td>
<td colspan="3" class="lii undl">Hamza Zafeer</td>
</tr>
<tr>
<td>Program:</td>
<td class="lii undl de">BS Civil Tech </td>
<td >Roll No.</td>
<td class="undl"></td>
</tr>
<tr>
<td>Semester</td>
<td class="undl"></td>
<td>Session</td>
<td class="undl">2018-2021</td>
</tr>
</table>
<table style="width:99%" class="fee">
<tr>
<th >PARTICULARS</th>
<th>Rs.</th>
<th>Ps.</th>
</tr>
<tr>
<td>Registration Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Admission Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Tuition Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Laboratory Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Library Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Transcript / Degree Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Examination Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Security Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Hostel Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Transport charges</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Fine</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Misc.</td>
<td>1000</td>
<td></td>
</tr>
<tr>
<td>Total Payable</td>
<td>1000</td>
<td></td>
</tr>
</table>
<div class="btm">
<div class="fm rss"><strong>Rs. in words :</strong> One thousand only</div>
<div class="fm bt"> Cashier</div>
</div>
</div></div>
<div class="par_col">
<div class="column">
<img src="a.jpg" alt="test">
<table style="width:99%" class="feetop">
<tr>
<td class="t_head">Challan No.</td>
<td class="lii undl">18584</td>
<td class="t_heada">Due Date:</td>
<td class="liia undl"></td>
</tr>
<tr>
<td class="t_head_c">Name</td>
<td colspan="3" class="lii undl">Hamza Zafeer</td>
</tr>
<tr>
<td>Program:</td>
<td class="lii undl de">BS Civil Tech </td>
<td >Roll No.</td>
<td class="undl"></td>
</tr>
<tr>
<td>Semester</td>
<td class="undl"></td>
<td>Session</td>
<td class="undl">2018-2021</td>
</tr>
</table>
<table style="width:99%" class="fee">
<tr>
<th >PARTICULARS</th>
<th>Rs.</th>
<th>Ps.</th>
</tr>
<tr>
<td>Registration Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Admission Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Tuition Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Laboratory Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Library Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Transcript / Degree Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Examination Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Security Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Hostel Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Transport charges</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Fine</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Misc.</td>
<td>1000</td>
<td></td>
</tr>
</table>
<div class="btm">
<div class="fm rss"><strong>Rs. in words :</strong> One thousand only</div>
<div class="fm bt"> Cashier</div>
</div>
</div></div>
<div class="par_col">
<div class="column">
<img src="s.jpg" alt="test">
<table style="width:99%" class="feetop">
<tr>
<td class="t_head">Challan No.</td>
<td class="lii undl">18584</td>
<td class="t_heada">Due Date:</td>
<td class="liia undl"></td>
</tr>
<tr>
<td class="t_head_c">Name</td>
<td colspan="3" class="lii undl">Hamza Zafeer</td>
</tr>
<tr>
<td>Program:</td>
<td class="lii undl de">BS Civil Tech </td>
<td >Roll No.</td>
<td class="undl"></td>
</tr>
<tr>
<td>Semester</td>
<td class="undl"></td>
<td>Session</td>
<td class="undl">2018-2021</td>
</tr>
</table>
<table style="width:99%" class="fee">
<tr>
<th >PARTICULARS</th>
<th>Rs.</th>
<th>Ps.</th>
</tr>
<tr>
<td>Registration Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Admission Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Tuition Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Laboratory Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Library Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Transcript / Degree Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Examination Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Security Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Hostel Fee</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Transport charges</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Fine</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Misc.</td>
<td>1000</td>
<td></td>
</tr>
</table>
<div class="btm">
<div class="fm rss"><strong>Rs. in words :</strong> One thousand only</div>
<div class="fm bt"> Cashier</div>
</div>
</div></div>
OUTPUT of HTML
But When i generate PDF, each section converted into a single page, and final PDF consisted on 3 pages.
Problem
It should not generate the 3 pages of PDF. Anybody can tell me what i am doing wrong, why it is creates 3 pages instead of 1 page?
I think it lacks the space, try to wrap your tables in one more table, like:
<table>
<tr>
<td>%table1HTML%</td>
</tr>
<tr>
<td>%table2HTML%</td>
</tr>
<tr>
<td>%table3HTML%</td>
</tr>
</table>

PHP/HTML: Replace everything between <TD colspan=6 ...> .... </TD>

I want to replace everything between a TD-Tag that has the attribute/value colspan=6.
All this I want to replace ...
<TD colspan=6 rowspan=4 align="center" nowrap="1">
<TABLE>
<TR>
<TD width="50%" nowrap=1><font size="3" face="Arial">
Some Text
</font>
</TD>
</TR>
<TR>
<TD width="50%" nowrap=1><font size="3" face="Arial">
Some Text
</font>
</TD>
</TR>
<TR>
<TD width="50%" nowrap=1><font size="3" face="Arial">
Some Text
</font>
</TD>
</TR>
</TABLE>
</TD>
...with this lines:
<TD colspan=12 rowspan=2 align="center" nowrap="1">
<TABLE>
<TR>
<TD>frei</TD>
Some Text
</TR>
</TABLE>
</TD>
Any Ideas? Maybe with simple_html_dom.php?
Solved with PHP and Regex:
$plan1 = preg_replace('~<TD colspan=6.*?</TR></TABLE></TD>~s",
"<TD colspan=12 rowspan=2 align="center" nowrap="1">
<TABLE><TR><TD></TD></TR></TABLE></TD>', $plan1);

Creating PDF with TCPDF shows Undefined index: cols in tcpdf/tcpdf.php on line 16928

I wanted to use TCPDF to generate a PDF report. but every time it shows me error on line 16928 and I can't understand what to do...
It would be great if you could help me
here is my code:
<?php
$html = "
<html>
<head>
<link rel='stylesheet' href='form.css'>
</head>
<body>
<div class='header'>
<h4>وزارت بهداشت، درمان و آموزش کشور</h4>
<h4>Ministry of Health & Medical Education</h4>
<table>
<tr>
<td class='engterm'>University of medical science:</td><td class='val'>[SAMPLE_ECHO]</td><td class='perterm'>دانشگاه علوم پزشکی:</td>
</tr>
<tr>
<td class='engterm'>Medical center:</td><td class='val'>[SAMPLE_ECHO]</td><td class='perterm'>مرکز پزشکی آموزشی درمانی:</td>
</tr>
</table>
</div>
<div class='body'>
<table class='main' border='1'>
<tr>
<td class='main' colspan='1' rowspan='2' style='text-align: left;'>
<table style='margin: 0 auto;'>
<tr>
<td class='engterm'>Clinic no.:</td><td class='val'>[sample]</td><td class='perterm'>شماره درمانگاهی:</td>
</tr>
</table>
</td>
<td class='main' colspan='2' rowspan='2' style='text-align: center; width: 50%'>
<h4>برگ خلاصه پرونده</h4>
<h4>Unit Summery Sheet</h4>
</td>
<td class='main' colspan='1' rowspan='2' style='direction: ltr;'>
<table style='margin: 0 auto;'>
<tr>
<td class='engterm'>Unit no.:</td><td class='val'>[sample]</td><td class='perterm'>شماره پرونده:</td>
</tr>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td class='main' rowspan='1'>
<table class='data'>
<td>Attending Physician:</td><td>SampleData</td><td>پزشک معالج:</td>
</table>
</td>
<td class='main' rowspan='2'>
<table class='data'>
<tr><td>Ward:</td><td>Sample</td><td>بخش:</td></tr>
<tr><td>Room:</td><td>Sample</td><td>اتاق:</td></tr>
<tr><td>Bed:</td><td>Sample</td><td>تخت:</td></tr>
</table>
</td>
<td class='main' rowspan='1'>
<table class='data'>
<td>Name:</td><td>Sample</td><td>نام:</td>
</table>
</td>
<td class='main' rowspan='1'>
<table class='data'>
<td>Family name:</td><td>Sample</td><td>نام خانوادگی:</td>
</table>
</td>
</tr>
<tr>
<td class='main'>
<table class='data'>
<td>Admission date:</td><td>Sample</td><td>تاریخ پذیرش:</td>
</table>
</td>
<td class='main'>
<table class='data'>
<td>Date of Birth:</td><td>Sample</td><td>تاریخ تولد:</td>
</table>
</td>
<td class='main'>
<table class='data'>
<td>Father's name:</td><td>Sample</td><td>نام پدر:</td>
</table>
</td>
</tr>
<tr>
<td class='main'>
<table class='data'>
<td></td><td>Sample</td><td>تاریخ ترخیص:</td>
</table>
</td>
<td class='main'>
<table class='data'>
<td>Occupation:</td><td>Sample</td><td>شغل:</td>
</table>
</td>
<td class='main'>
<table class='data'>
<td>Marriage status:</td>
<td>
<input type='radio' name='marriage_status' value='married'>متاهل / Married<br>
<input type='radio' name='marriage_status' value='single'>مجرد / Single
</td>
<td>وضعیت تاهل:</td>
</table>
</td>
<td class='main'>
<table class='data'>
<td>Sex:</td>
<td>
<input type='radio' name='sex' value='male'>مرد / Male<br>
<input type='radio' name='sex' value='female'> زن / Female
</td>
<td>جنسیت:</td>
</table>
</td>
</tr>
<tr>
<td colspan='4'>
<table class='data'>
<td colspan='1' style='text-align: left;'>Address:</td><td colspan='2'>Sample</td><td colspan='1' style='text-align: right;'>آدرس:</td>
</table>
</td>
</tr>
<tr>
<td colspan='4'>
<table class='data'>
<td colspan='1'>Final Diagnosis:</td>
<td colspan='2'>Sample</td>
<td colspan='1'>تشخصی نهایی:</td>
</table>
</td>
</tr>
<tr>
<td colspan='4'>
<table class='data'>
<td colspan='1'>Medical & Surgical Procedures:</td>
<td colspan='2'>Sample</td>
<td colspan='1'>اقدامات درمانی و اعمال جراحی:</td>
</table>
</td>
</tr>
<tr>
<td colspan='4'>
<table class='data'>
<td colspan='1'>Results of Paraclinical Examination:</td>
<td colspan='2'>Sample</td>
<td colspan='1'>پاراكلينيكي آزمايشات نتايج:</td>
</table>
</td>
</tr>
<tr>
<td colspan='4'>
<table class='data'>
<td colspan='1'>Disease Progress (Cause of Death):</td>
<td colspan='2'>Sample</td>
<td colspan='1'>سیر بیماری (درصورت فوت، علت مرگ):</td>
</table>
</td>
</tr>
<tr>
<td colspan='4'>
<table class='data'>
<td colspan='1'>Patient's Condition on Discharge:</td>
<td colspan='2'>Sample</td>
<td colspan='1'>وضعیت بیمار هنگام ترخیض:</td>
</table>
</td>
</tr>
<tr>
<td colspan='4'>
<table class='data'>
<td colspan='1'>Recommendations after discharge:</td>
<td colspan='2'>Sample</td>
<td colspan='1'>توصیه‌های پس از ترخیض:</td>
</table>
</td>
</tr>
<tr>
<td colspan='4'>
<table class='data'>
<td colspan='1'>Attending Physician's Name & Signature:</td>
<td colspan='2'>Sample</td>
<td colspan='1'>نام و امضا پزشک معالج:</td>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>";
require_once('tcpdf/tcpdf.php');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
if (#file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
$pdf->SetFont('helvetica', '', 9);
$pdf->AddPage();
$pdf->writeHTML($html, true, 0, true, 0);
$pdf->lastPage();
$pdf->Output('htmlout.pdf', 'I');
?>
When reading the page from web server, it shows me the following error:
Notice: Undefined index: cols in /home/aien/public_html/Arash.Sammak/JSON Return/tcpdf/tcpdf.php on line 16928
You have to add a valid <thead> element to every table. TCPDF parses the <thead> element to determine the number of columns in a table when it outputs tables in PDF.
Also, check your HTML twice is valid or not if some other errors keep occurring.
Hope this helps.

How to automatically generate rowspan using php

In this code everything is perfect except that I could not generate rowspan in the Internal Grade cell. this line <td rowspan="<?php echo $cols;?>"> hides the bottom border while I expect to span the rows every time the code generates rows. Thanks for your input and sorry for using mysql() function. I am newbie.
<?php $cols=mysql_num_rows($grds); ?>
<table>
<?php do{ ?>
<tr>
<td> </td>
//This hide the bottom border
<td rowspan="<?php echo $cols;?>">Internal<br />Grades</td>
<td colspan="2"> <?php echo strtoupper($row_grds['grade_name']); ?></td>
<td><?php echo strtoupper($row_grds['igrade']); ?></td>
<?php } while ($row_grds=mysql_fetch_assoc($grds)); ?>
</tr>
</table>
The output is like below:
output is here
The code generated by php is:
<table>
<tr>
<td> </td>
<td rowspan="1"> </td>// A
<td colspan="2"> RHYMES</td>
<td align="center">B</td>
</tr>
<tr>
<td> </td>
<td rowspan="2"> </td>//B
<td colspan="2"> CONVERSATION</td>
<td align="center">A</td>
</tr>
</table>
I want to merge A and B
Expected output is:
<table>
<tr>
<td> </td>
<td rowspan="2"> Internal<br /> Grade</td>
<td colspan="2"> RHYMES</td>
<td align="center">B</td>
</tr>
<tr>
<td> </td>
<td colspan="2"> CONVERSATION</td>
<td align="center">A</td>
</tr>
</table>
You can do something similar to this:
<table>
<?php $row_grds = mysql_fetch_assoc($grds); ?>
<tr>
<td> </td>
<td rowspan="<?=$cols;?>">Internal<br />Grades</td>
<td colspan="2"> <?=strtoupper($row_grds['grade_name']);?></td>
<td><?=strtoupper($row_grds['igrade']);?></td>
</tr>
<?php while ($row_grds=mysql_fetch_assoc($grds)): ?>
<tr>
<td> </td>
<td colspan="2"> <?=strtoupper($row_grds['grade_name']);?></td>
<td><?=strtoupper($row_grds['igrade']);?></td>
</tr>
<?php endwhile; ?>
Its not perfect but you are using mysql_fetch_assoc, which on its own is not perfect either :D

update mysql table with list values

i have a form that extract data from mysql table into a form, each row has a menu to choose a value from and i want to update mysql with each value choosen for each row when the 'Apply To All' button is clicked but doesnt work at all.,here is my code.
<td><form id="main" name="main" method="post" action="setProjectStatus.php" onsubmit="return validateMain();">
<table width="100%" cellspacing="1" cellpadding="1">
<tr>
<td width="35%" rowspan="3"><img src="../img/project.jpg" alt="Comp Sci Stud" width="325" height="199" border="2" /></td>
<td width="65%" height="42" colspan="2"><table width="94%" cellpadding="1" cellspacing="1" class="main_table">
<tr class="table_title">
<td width="100%" class="table_title">Set Project Status. </td>
</tr>
<tr>
<td height="26"> </td>
</tr>
<tr>
<td height="26"><table width="100%" cellspacing="1" cellpadding="1">
<tr class="table_head">
<td width="2%" height="35"><div align="center"></div></td>
<td width="26%" height="35"><div align="center">Student Name</div></td>
<td colspan="2"><div align="center">Project</div></td>
<td width="19%"><div align="center">Status</div></td>
</tr>
<?php
session_start();
$username = $_SESSION['username'];
require_once("mysqlConnect.php");
//
$sql="SELECT * FROM spms_Student";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
echo "There are $count projects to be undertaken.";
while($rows=mysql_fetch_array($result)){
//
$query = "SELECT name FROM spms_systemUser WHERE userId = '".$rows[0]."'";
$result1 = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result1);
$name = $row[0];
?>
<tr>
<td height="25" align="center"> </td>
<td align="center"><?php echo $name; ?></td>
<td colspan="2" align="center"><?php echo $rows[1]; ?></td>
<td align="center"><label>
<select name="select" class="form_field_100px_select">
<option value="Pending" selected="selected">Pending</option>
<option value="Approved">Approved</option>
<option value="Disapproved">Disapproved</option>
</select>
</label></td>
</tr>
<?php
}
?>
<tr class="pager_bg">
<td height="35"> </td>
<td> </td>
<td width="37%" align="right"><input name="done" type="button" id="done" value="Done" onclick="window.location='../coordinatorMenu.html'" /></td>
<td width="16%"><label>
<input name="approveAll" type="submit" id="approveAll" value="Approve All" />
</label></td>
<td><input name="apply" type="submit" id="apply" value="Apply To All" /></td>
</tr>
<?php
mysql_close();
?>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><label></label> <label></label></td>
</tr>
</table>
</form></td>
You're trying to reuse your MySQL connection while still holding on to the resultset from the first query. You need to create a second connection for the inner loop queries. Even better would probably be to rewrite your query using a join, but I can't say for sure without knowing your schema.

Categories