Código HTML:
<table border="1"> <tr> <td>ID</td>1234<td>Empresa</td><td>Marca</td> </tr> <tr> <td>1</td><td>409</td><td>Coca-Cola</td> </tr> <tr> <td>2</td><td>4567</td><td>Pepsi</td> </tr> <tr> <td>3</td><td>4322</td><td>Red Cola</td> </tr> <tr> <td>4</td><td>409</td><td>Fanta</td> </tr> </table>
Código HTML:
<table width="200" border="1"> <tr> <td>id</td> <td>numero</td> <td>marca</td> </tr> <tr> <td>1</td> <td rowspan="2">409</td> <td>coca cola</td> </tr> <tr> <td>2</td> <td>Fanta</td> </tr> </table>
Dejo mi codigo, espero que me puedan ayudar.
<?php
$conexion = mysql_connect("xx", "x","x");
mysql_select_db("pruebas", $conexion);
$misql=mysql_query("SELECT * FROM user ORDER BY numero_empleado ASC", $conexion);
$sql=mysql_query("SELECT * FROM user ORDER BY numero_empleado ASC", $conexion);
$filas = mysql_num_rows($misql);
$z=1;
$y=1;
echo "<table border='1'>";
for($i=0; $i<=$filas; $i++)
{
if($row = mysql_fetch_row($misql))
{
mysql_data_seek($sql, $y);
if($rana = mysql_fetch_row($sql))
{
if($row[1] == $rana[1])
{
$spam=+1;
echo "$spam";
$suma=$spam+$suma;
echo $suma;
echo "<tr><td>$i .- $row[1]</td>";
}
else
{
echo "<tr><td>$i .- $row[1]</td>";
}
//echo "<tr><td rowspan='$spam'>$i .- $row[1]</td>";
}
if(mysql_data_seek($sql, $z))
{
$francia= mysql_fetch_row($sql);
if($francia[$z] == $row[$i])
{
echo "<td>$row[2]</td></tr>";
}
else
{
echo "<td>$row[2]</td></tr>";
}
}
}
if($z<$misql)
{
$z++;
$y++;
}
}
echo "</table>";