zerocool786
Active Member
I have data inserted into MYSQL like below
Name.....empid.....Description....quantity...
A.............1..............Vacation.........5
B............2...............Vacation.........9
A.............1..............Sick................4
I want to display like this on the webpage
Name....empid.....Vacation....Sick
A..............1...............5................4
B..............2...............9................0
How can I do this, buys using php mysql? Here is my code below
thanks in advance
Name.....empid.....Description....quantity...
A.............1..............Vacation.........5
B............2...............Vacation.........9
A.............1..............Sick................4
I want to display like this on the webpage
Name....empid.....Vacation....Sick
A..............1...............5................4
B..............2...............9................0
How can I do this, buys using php mysql? Here is my code below
Code:
<?php
include ("connection.php");
if(isset($_POST["delete1"]))
{
$c = 0;
$sql = 'SELECT * FROM internalhrs WHERE description="Administration"';
mysql_select_db('XXX');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not get data: ' . mysql_error());
}
echo "
<table border='1'>
<tr>
<th>Name</th>
<th>Emp ID</th>
<th>Description</th>
<th>Quantity</th>
</tr>";
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['empid'] . "</td>";
echo "<td>" . $row['description'] . "</td>";
echo "<td>" . $row['quantity'] . "</td>";
echo "</tr>";
}
echo "Loaded ";
$sql = 'SELECT * FROM internalhrs WHERE description="Statutory Holiday"';
mysql_select_db('XXX');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
echo "<td>" . $row['description'] . "</td>";
echo "</tr>";
}
echo "Loaded ";
}
?>
thanks in advance