How to add BR between mysql record output - php

I have a PHP page where user can select a province (ex. A, B) then click search. The output will be coming from the database. Now how can I group the data and add BR in between? example:
user choose province: prov_A
output:
program name: FLOOD CONTROL-prov_A-ALLOCATION
FLOOD CONTROL-prov_A-ALLOCATION
ROADS-prov_A-ALLOCATION
ROADS-prov_A-ALLOCATION
I want to separate flood control from roads. Btw, I'm using Wordpress for this. A line break between will do. Also, the field 'allocation' from my excel file contain amounts like 7,000,000.00 or 1,000,000.00 but after importing to phpmyadmin it becomes 7.0 and 1.0. What data field should I use?
CODE:
$sql = "SELECT * FROM projects where province = '$province'";
//select database
mysql_select_db('pdmu');
//query for counting
$query="SELECT COUNT(proj_id) AS 'cnt' FROM `projects` WHERE province = '$province'";
$result=mysql_query($query);
$row2 = mysql_fetch_assoc($result, MYSQL_ASSOC);
print_r($row2['cnt']); print_r('Records Found');
//echo $row2['cnt'] . 'RECORDS FOUND!';
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not get data: ' . mysql_error());
}
echo "<table>";
echo "<tr>";
echo "<th>";
echo "PROGRAM NAME";
echo "</th>";
echo "<th>";
echo "PROVINCE";
echo "</th>";
echo "<th>";
echo "MUNICIPALITY/CITY";
echo "</th>";
echo "<th>";
echo "NO. OF PROJECT";
echo "</th>";
echo "<th>";
echo "PROJECT NAME";
echo "</th>";
echo "<th>";
echo "ALLOCATION";
echo "</th>";
echo "<th>";
echo "PHYSICAL STATUS";
echo "</th>";
echo "<th>";
echo "FINANCIAL STATUS";
echo "</th>";
echo "<th>";
echo "REMARKS";
echo "</th>";
echo "</tr>";
echo $count . $row2;
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
echo '<tr>' . '<td>' . $row['prog_name'] . '</td>' . '<td>' . $row['province'] . '</td>' . '<td>' . $row['municipality'] . '</td>' . '<td>' . $row['proj_no'] . '</td>' . '<td>' . $row['proj_name'] . '</td>' . '<td>' . $row['allocation'] . '</td>' . '<td>' . $row['ph_status'] . '</td>' . '<td>' . $row['fin_status'] . '</td>' . '<td>' . $row['remarks'] . '</td>' .'</tr>';}
mysql_close($conn);

<?php
$sql = "SELECT * FROM projects where province = '$province'";
//select database
mysql_select_db('pdmu');
//query for counting
$query="SELECT COUNT(proj_id) AS 'cnt' FROM `projects` WHERE province = '$province'";
$result=mysql_query($query);
?>
<?php $row = mysql_fetch_assoc($result);
while($row_result = mysql_fetch_array($retval, MYSQL_ASSOC))
{
?>
<tr>
<td><?=$row_result['your fields'];?></td>
</tr>
<?php } ?>

Related

Using checkbox in echo as table

I have a code where I echo a table:
<?php
// connect to the database
include('core/base.php');
// get results from database
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM uitslag ORDER BY ID ASC")
or die(((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
// display data in table
echo "<table border='1' cellpadding='10'>";
echo "<tr> <th>Nummer</th><th>Naam</th><th>Telefoon</th><th>Binnen</th> <th>Adres</th> <th>Postcode</th> <th>Wijk</th></tr>";
// loop through results of database query, displaying them in the table
while($row = mysqli_fetch_array( $result )) {
// echo out the contents of each row into a table
echo "<tr>";
echo '<td>' . $row['ID'] . '</td>';
echo '<td>' . $row['Naam'] . '</td>';
echo '<td>' . $row['Telefoon'] . '</td>';
echo '<td>' . $row['Binnen'] . '</td>';
echo '<td>' . $row['Adres'] . '</td>';
echo '<td>' . $row['Postcode'] . '</td>';
echo '<td>' . $row['Wijk'] . '</td>';
echo '<td>Aanpassen</td>';
echo "</tr>";
}
// close table>
echo "</table>";
?>
The row 'Telefoon' either echos 1 or 0. How can I echo a checkbox which is checked when 1 instead of echoing the actual number?
Define input element of type checkbox.Like this.
$telefoon = ($row['Telefoon']==1)?'checked':'';
echo '<td>' . $row['ID'] . '</td>';
echo '<td>' . $row['Naam'] . '</td>';
echo "<td><input type='checkbox' $telefoon></td>";
echo '<td>' . $row['Binnen'] . '</td>';
echo '<td>' . $row['Adres'] . '</td>';
echo '<td>' . $row['Postcode'] . '</td>';
echo '<td>' . $row['Wijk'] . '</td>';
<?php
if($row['Telefoon']==1){
echo "<td><input type='checkbox' checked></td>";
}
else {
echo "<td><input type='checkbox' ></td>";
}
?>

PHP echo without a loop. SQL Query

Here is the subject matter: Link, Click a players name to see.
I want to have the players name as a header so that the players name isn't repeated over and over again for each resulting row in the Roster table. I know how to loop through results for rows, but I only want the name once at the top and don't know how to do that. This is how I print the table code wise
<?php
$pid = $_POST['PID'];
$query = "SELECT Rosters.PID, Rosters.Goals, Rosters.Assists, Rosters.PIM, Rosters.Num, Rosters.TID, Players.pid, Players.firstname, Players.lastname,
(Rosters.Goals + Rosters.Assists) AS Points
FROM Rosters
INNER JOIN Players
ON Rosters.PID = Players.pid
WHERE Rosters.PID = $pid
ORDER BY Points DESC, Goals DESC";
$result = $conn->query($query);
$query2 = "SELECT Rosters.PID, SUM( Rosters.Goals ) Goals, SUM( Rosters.Assists ) Assists, SUM( Rosters.PIM ) PIM, Rosters.Num, Rosters.TID, Players.pid, Players.firstname, Players.lastname,
SUM((Rosters.Goals + Rosters.Assists)) AS Points
FROM Rosters
INNER JOIN Players ON Rosters.PID = Players.pid
WHERE Rosters.PID =$pid
ORDER BY Points DESC , Goals DESC";
$result2 = $conn->query($query2);
echo
if (!empty($_POST["PID"])) {
echo "<table class='stat-table-wide table sortable' align='center'>";
echo "<tr>";
echo "<th class='hover'>Season</th>";
echo "<th class='hover'>Num</th>";
echo "<th class='hover'>Player</th>";
echo "<th class='hover'>G</th>";
echo "<th class='hover'>A</th>";
echo "<th class='hover'>Pts</th>";
echo "<th class='hover'>PIM</th>";
echo "</tr>";
$i = 13;
$j = 14;
while ($row = $result->fetch_assoc()) {
$i++;
$j++;
$goals = $row["Goals"];
$assists = $row["Assists"];
$points = $goals + $assists;
echo "<tr><td>20" . $i . "-20" . $j . "</td>";
echo "<td>" . $row["Num"] . "</td>";
echo "<td>" . $row["firstname"] . " " . $row["lastname"] . "</td>";
echo "<td>" . $row["Goals"] . "</td>";
echo "<td>" . $row["Assists"] . "</td>";
echo "<td>" . $row["Points"] . "</td>";
echo "<td>" . $row["PIM"] . "</td></tr>";
}
echo "</table>";
echo "<span class='style35'>Total</span><br />";
echo "<table class='stat-table-wide table sortable' align='center'>";
echo "<tr>";
echo "<th class='hover'>Player</th>";
echo "<th class='hover'>G</th>";
echo "<th class='hover'>A</th>";
echo "<th class='hover'>Pts</th>";
echo "<th class='hover'>PIM</th>";
echo "</tr>";
while ($row = $result2->fetch_assoc()) {
$goals = $row["Goals"];
$assists = $row["Assists"];
$points = $goals + $assists;
echo "<td>" . $row["firstname"] . " " . $row["lastname"] . "</td>";
echo "<td>" . $row["Goals"] . "</td>";
echo "<td>" . $row["Assists"] . "</td>";
echo "<td>" . $row["Points"] . "</td>";
echo "<td>" . $row["PIM"] . "</td></tr>";
}
echo "</table>";
}
?>
I just want Players.firstname and Players.lastname printed once before any of the tables are generated.
Try this:
if (!empty($_POST["PID"])) {
$row = $result->fetch_assoc();
echo "<span class='style35'>" . $row["firstname"] . " " . $row["lastname"] . "</span><br />";
$result->data_seek(0);
echo "<table class='stat-table-wide table sortable' align='center'>";
echo "<tr>";
echo "<th class='hover'>Season</th>";
echo "<th class='hover'>Num</th>";
echo "<th class='hover'>G</th>";
echo "<th class='hover'>A</th>";
echo "<th class='hover'>Pts</th>";
echo "<th class='hover'>PIM</th>";
echo "</tr>";
$i = 13;
$j = 14;
while ($row = $result->fetch_assoc()) {
$i++;
$j++;
$goals = $row["Goals"];
$assists = $row["Assists"];
$points = $goals + $assists;
echo "<tr><td>20" . $i . "-20" . $j . "</td>";
echo "<td>" . $row["Num"] . "</td>";
echo "<td>" . $row["Goals"] . "</td>";
echo "<td>" . $row["Assists"] . "</td>";
echo "<td>" . $row["Points"] . "</td>";
echo "<td>" . $row["PIM"] . "</td></tr>";
}
echo "</table>";
echo "<span class='style35'>Total</span><br />";
echo "<table class='stat-table-wide table sortable' align='center'>";
echo "<tr>";
echo "<th class='hover'>Player</th>";
echo "<th class='hover'>G</th>";
echo "<th class='hover'>A</th>";
echo "<th class='hover'>Pts</th>";
echo "<th class='hover'>PIM</th>";
echo "</tr>";
while ($row = $result2->fetch_assoc()) {
$goals = $row["Goals"];
$assists = $row["Assists"];
$points = $goals + $assists;
echo "<td>" . $row["firstname"] . " " . $row["lastname"] . "</td>";
echo "<td>" . $row["Goals"] . "</td>";
echo "<td>" . $row["Assists"] . "</td>";
echo "<td>" . $row["Points"] . "</td>";
echo "<td>" . $row["PIM"] . "</td></tr>";
}
echo "</table>";
}
?>
I don't know if you wanted the name of the player in the totals, so I left it there, but you can delete it if you want. I also applied to the player name the same style as the total.
You could get the first row of the result before your loop, then just reset the cursor, and completely ignore the players name inside your loop.
$first = $result->fetch_assoc();
// print out first name
echo($first['name'] . " " . $first['surname']);
// reset cursor
$result->data_seek(0);
// do your loops and stuff.
while ($row = $result->fetch_assoc()) {
...
}
You can do like this.If you do not want to change the sql query.
$ctr = 0;
while ($row = $result->fetch_assoc()) {
$ctr++;
if($ctr == 1) {
echo "</table>";
echo "<span class='style35'>Total</span><br />";
echo "<table class='stat-table-wide table sortable' align='center'>";
echo "<tr>";
echo "<th class='hover'>Player</th>";
echo "<th class='hover'>G</th>";
echo "<th class='hover'>A</th>";
echo "<th class='hover'>Pts</th>";
echo "<th class='hover'>PIM</th>";
echo "</tr>";
echo "<tr><td>" . $row["firstname"] . " " . $row["lastname"] . "</td> </tr>";
}
$i++;
$j++;
$goals = $row["Goals"];
$assists = $row["Assists"];
$points = $goals + $assists;
echo "<tr><td>20" . $i . "-20" . $j . "</td>";
echo "<td>" . $row["Num"] . "</td>";
echo "<td>" . $row["firstname"] . " " . $row["lastname"] . "</td>";
echo "<td>" . $row["Goals"] . "</td>";
echo "<td>" . $row["Assists"] . "</td>";
echo "<td>" . $row["Points"] . "</td>";
echo "<td>" . $row["PIM"] . "</td></tr>";
}

Why is my ForEach loops only returning one line?

<!doctype html>
<?php
?>
<html>
<head>
<title>Midterm Review</title>
</head>
<body>
<h3>Tools Not Currently in Stock</h3>
<?php
$conn = mysqli_connect(This part works );
mysqli_select_db(this part works);
$query = "SELECT * FROM `midterm` WHERE stock='0'";
$result = mysqli_query($conn, $query);
echo '<table>';
echo '<tr><th>ID</th><th>Part Number</th><th>Description</th><th>Stock</th><th>Price</th><th>Received</th></tr>';
foreach ($result as $row) {
$row = mysqli_fetch_array($result);
echo '<tr>';
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['part_number'] . '</td>';
echo '<td>' . $row['description'] . '</td>';
echo '<td>' . $row['stock'] . '</td>';
echo '<td>' . $row['price'] . '</td>';
echo '<td>' . $row['received_date'] . '</td>';
echo '</tr>';
echo '</table>';
};
mysqli_close($conn);
?>
<!--<form method="post" action="midterm_confirmation.php">
<label>Part Number: </label><input type="text" name="partNumber" /><br />
<label>Description: </label><input type="text" name="description" /></br />
<label>Stock: </label><input type="number" name="stock" /><br />
<label>Price: </label><input type="text" name ="price" /></br />
<label>Received Date: </label><input type="text" name="receivedDate" /></br />
<input type="Submit" value="Add to Stock">
</form> -->
</body>
</html>
Basically my end result is that I am getting one table row, instead the two I am getting. Any suggestions? The table I have populates everything but is only running once, instead of posting for each line I have where stock is equal to zero.
See the snippet below. P.S. Don't mix templates and database layer, it's a bad smell...
<?php
// establish connection to $conn variable
$query = mysqli_query($conn, "SELECT * FROM `midterm` WHERE stock='0'");
echo '<table>';
echo '<tr><th>ID</th><th>Part Number</th><th>Description</th><th>Stock</th><th>Price</th><th>Received</th></tr>';
while ($row = mysqli_fetch_assoc($query)) {
echo '<tr>';
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['part_number'] . '</td>';
echo '<td>' . $row['description'] . '</td>';
echo '<td>' . $row['stock'] . '</td>';
echo '<td>' . $row['price'] . '</td>';
echo '<td>' . $row['received_date'] . '</td>';
echo '</tr>';
}
echo '</table>';
mysqli_close($conn);
?>
The problem is in closing of </table> It should be kept outside the loop.
while ($row = mysqli_fetch_assoc($query)) {
echo '<tr>';
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['part_number'] . '</td>';
echo '<td>' . $row['description'] . '</td>';
echo '<td>' . $row['stock'] . '</td>';
echo '<td>' . $row['price'] . '</td>';
echo '<td>' . $row['received_date'] . '</td>';
echo '</tr>';
// echo '</table>';// this is wrong.
};
echo '</table>';// this is correct. closing table inside loop is wrong, do it outside the loop.
You can simply use a while loop to do it like below:
<?php
// establish connection to $conn
$query = mysqli_query($conn, "SELECT * FROM `midterm` WHERE stock='0'");
echo '<table>';
echo '<tr><th>ID</th><th>Part Number</th><th>Description</th><th>Stock</th><th>Price</th><th>Received</th></tr>';
while ($row = mysqli_fetch_assoc($query)) {
echo '<tr>';
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['part_number'] . '</td>';
echo '<td>' . $row['description'] . '</td>';
echo '<td>' . $row['stock'] . '</td>';
echo '<td>' . $row['price'] . '</td>';
echo '<td>' . $row['received_date'] . '</td>';
echo '</tr>';
}
echo '</table>'; // this should be outside the loop
mysqli_close($conn);
?>
Or if you want to use a foreach then write an extra function for it:
<?php
function mysql_fetch_all($result) {
$rows = array();
while ($row = mysql_fetch_array($result)) {
$rows[] = $row;
}
return $rows;
}
// establish connection to $conn
$query = mysqli_query($conn, "SELECT * FROM `midterm` WHERE stock='0'");
echo '<table>';
echo '<tr><th>ID</th><th>Part Number</th><th>Description</th><th>Stock</th><th>Price</th><th>Received</th></tr>';
foreach (mysql_fetch_all($result) as $row){
echo '<tr>';
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['part_number'] . '</td>';
echo '<td>' . $row['description'] . '</td>';
echo '<td>' . $row['stock'] . '</td>';
echo '<td>' . $row['price'] . '</td>';
echo '<td>' . $row['received_date'] . '</td>';
echo '</tr>';
}
echo '</table>'; // this should be outside the loop
mysqli_close($conn);
?>

My dropdown list would not drop down

I tried to use php to create a dropdown list populated by a SELECT query but it would not dropdown. Here is my php script
<?php
require_once ('mysqli_connect.php');
#mysqli_select_db($dbc,"test");
$query = "SELECT category_id, category_name FROM forum_category ORDER BY category_name";
$result = #mysqli_query($dbc, $query);
if(!$result)
{
echo "query error: " . mysqli_error($dbc);
}
// while($row = #mysqli_fetch_array($result))
// {
// echo "<p>$row[0] $row[1]</p>\n"; //this works
// }
echo "<td bgcolor=\"#E6E6E6\"";
echo "<strong>Category:</strong>";
echo "<select name=\"category\">";
while($row = #mysqli_fetch_array($result))
{
// echo "<p><option value='".$row[0]."'>".$row[1]."</option></p>\n";
echo "<option value='".$row[0]."'>".$row[1]."</option>";
}
mysqli_close($dbc);
echo "</select>";
echo "</td>";
?>
The query worked (the commented while loop outside the dropdown list displayed 15 records). But the dropdown list only showed one category_name and would not dropdown. Can someone help me figure out the problem? Thanks.
There are a few problems with your code.
You can either remove both echo "<td bgcolor=\"#E6E6E6\""; and echo "</td>";
which is the reason why your data is not showing.
Or, add the appropriate <table></table> tags.
Plus this echo "<td bgcolor=\"#E6E6E6\""; should be echo "<td bgcolor=\"#E6E6E6\">"; there was a missing > so that alone is breaking your <td>.
So in order to have the proper table syntax do:
Sidenote: I added . "\n" in order to get clean and well-aligned HTML source.
<?php
require_once ('mysqli_connect.php');
#mysqli_select_db($dbc,"test");
$query = "SELECT category_id, category_name FROM forum_category ORDER BY category_name";
$result = #mysqli_query($dbc, $query);
if(!$result)
{
echo "query error: " . mysqli_error($dbc);
}
echo "<table>" . "\n";
echo "<tr>" . "\n";
echo "<td bgcolor=\"#E6E6E6\">" . "\n";
echo "<strong>Category:</strong>" . "\n";
echo "<select name=\"category\">" . "\n";
while($row= mysqli_fetch_array($result)){
echo "<option value='".$row[0]."'>".$row[1]."</option>" . "\n";
}
echo "</select>" . "\n";
echo "</td>" . "\n";
echo "</tr>" . "\n";
echo "</table>" . "\n";
mysqli_close($dbc);
?>
Edit: (Try this) since I don't know what your full code looks like.
<form id="form1" name="form1" method="post" action="form1_handler.php">
<?php
require_once ('mysqli_connect.php');
#mysqli_select_db($dbc,"test");
if(isset($_POST['submit'])){
$query = "SELECT category_id, category_name FROM forum_category ORDER BY category_name";
$result = #mysqli_query($dbc, $query);
if(!$result)
{
echo "query error: " . mysqli_error($dbc);
}
echo "<table>" . "\n";
echo "<tr>" . "\n";
echo "<td bgcolor=\"#E6E6E6\">" . "\n";
echo "<strong>Category:</strong>" . "\n";
echo "<select name=\"category\">" . "\n";
while($row= mysqli_fetch_array($result)){
echo "<option value='".$row[0]."'>".$row[1]."</option>" . "\n";
}
echo "</select>" . "\n";
echo "</td>" . "\n";
echo "</tr>" . "\n";
echo "</table>" . "\n";
mysqli_close($dbc);
} // brace for if(isset($_POST['submit']))
?>
<input type="submit" name="submit" value="Submit">
</form>

how to show non matching mysql result

i m trying to create school fees recipt system
i create two table in phpmyadmin 1 is admission and 2nd is fees
1.admission
i create admission php form when i fill the admission form all detail save in admission table
2.fees
the same thing i create it in fees page
in admission table have all student info who are study in our school
and in fees table all info of student who paid the fees of the month
but now i want student fees report who are paid and who are not paid the fees
this code showing only paid student report
but i want both result who are paid and who are not paid how can i do this
please help me to fix this issue
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("student", $con);
echo "<div id='non-printable'><table class='sortable' border='1' cellpadding='10'>";
echo "<tr> <th>No</th> <th>Name</th><th>Date</th><th>GRN</th> <th>Reference</th><th>Class</th><th>Roll No</th><th>Fees</th></tr>";
// get results1 from database
$result1 = mysql_query("SELECT fees.id,fees.name,fees.date,fees.grn,fees.reference,fees.class,fees.rollno,fees.fees, admission.mothername "." FROM fees, admission ". " WHERE fees.name = admission.name AND fees.date BETWEEN '2013-04-01' AND '2013-04-14' AND fees.class='6' order by class ASC");
while($row = mysql_fetch_array($result1))
{
// echo out the contents of each row into a table
echo "<tr>";
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['name'] . '</td>';
echo '<td>' . $row['date'] . '</td>';
echo '<td>' . $row['grn'] . '</td>';
echo '<td>' . $row['reference'] . '</td>';
echo '<td>' . $row['class'] . '</td>';
echo '<td>' . $row['rollno'] . '</td>';
echo '<td>' . $row['fees'] . '</td>';
echo '<td>' . $row['mothername'] . '</td>';
echo "</tr>";
//Increment the value of the Total_total variable
//by the salary value of one row till the while loop finishes
$Total_fees=$Total_fees+$row['fees'];
}
echo "<tr>";
echo '<td>Total</td>';
echo '<td></td>';
echo '<td></td>';
echo '<td></td>';
echo '<td></td>';
echo '<td></td>';
echo '<td></td>';
echo '<td>' . $Total_fees .'</td>';
echo "</tr>";
// close table>
echo "</table>";
mysql_close($con);
?>
UPDATED
<?php
echo "<div id='non-printable'><table class='sortable' border='1' cellpadding='10'>";
echo "<tr> <th>No</th> <th>Name</th><th>Date</th><th>GRN</th> <th>Reference</th><th>Class</th><th>Roll No</th><th>Fees</th></tr>";
$dbserver = 'localhost';
$dblogin = 'root';
$dbpassword = '';
$dbname = 'student';
//opening connection
$mysqli = new mysqli($dbserver, $dblogin, $dbpassword, $dbname);
if (mysqli_connect_errno())
{
printf("Connection failed: %s\n", mysqli_connect_error());
exit();
}
//opening connection
$result = $mysqli->query("SELECT `name`, `mothername` FROM `admission` WHERE `class` = '6' ORDER BY `name` ASC") or die($mysqli->error.__LINE__);
while($student = $result->fetch_assoc())
{
$subresult = $mysqli->query("SELECT * FROM `fees` WHERE `name` = '".$student['name']."' AND `date` BETWEEN '2013-04-01' AND '2013-04-14'") or die($mysqli->error.__LINE__);
if($row = $subresult->fetch_assoc())
{
echo "<tr>";
echo '<td>Student</td>';
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['name'] . '</td>';
echo '<td>' . $row['date'] . '</td>';
echo '<td>' . $row['grn'] . '</td>';
echo '<td>' . $row['reference'] . '</td>';
echo '<td>' . $row['class'] . '</td>';
echo '<td>' . $row['rollno'] . '</td>';
echo '<td>' . $row['fees'] . '</td>';
echo '<td>' . $student['mothername'] . '</td>';
echo "</tr>";
}
else
{
echo "<tr>";
echo '<td>' . $student['name'] . '</td>';
echo '<td> didn\'t pay any fee.</td>';
echo "</tr>";
}
}
echo '</table>';
mysqli_close($mysqli);
?>
$result1 = mysql_query("SELECT fees.id, fees.name, fees.date, fees.grn,
fees.reference, fees.class, fees.rollno, fees.fees, admission.mothername ".
"FROM admission LEFT JOIN fees ON fees.name = admission.name".
"WHERE fees.date BETWEEN '2013-04-01' AND '2013-04-14' AND fees.class='6'
order by class ASC");
Use the Left join so you can get all the rows of admission table and the corresponding rows
of fees table. In this way you can get the blank data of fee table also.

Categories