It is necessary to create the similarity of such a table. enter image description here

Data is taken from the database. The problem is that there is not even an idea how to do it. I do not know what to take and where to start. If I just drew a table by hand using (every cell), it would seem to be much easier. Would register styles in and the trick is in the hat. But I pull the records out of the database using this code:

$row = mysql_fetch_assoc($res); print '<table><tr>'; foreach ($row as $name => $value){ print "<th>$name</th>"; } while($row){ print '<tr>'; foreach($row as $value){ print "<td>$value</td>"; } print '<tr>'; $row = mysql_fetch_assoc($res); } print '</table>'; 

It turns out this: enter image description here

I do not ask to write code for me. And at least give some impetus and direction. Perhaps you need to somehow pull out the data differently, or to draw a table manually? Because right now I cannot divide the cells in any way, there is only , , , . That is, in I can make changes only for everything together, and not for each element separately. I apologize if the question is stupid. I really hope for help.

  • What difference does the data come from? This is the client side. And it's not entirely clear, what do you want? Make field filtering, delete / edit, etc., etc.? Then what's the problem, learn javascript , how pagination works. You can say you are doing a DataGrid, which by the way is not so little. Look at the finished examples, maybe you won't need to fence your bike - Vasily Barbashev
  • Yes, so far without functionality, just to impose such a table. Just if I drew each cell manually, I could specify my own styles for each. And since my table is generated using php, I cannot figure out how to bring it into a beautiful view. For if I edit, let's say, styles for td, then they will apply to all td in the table, and not to any specific ones. - luckydutch
  • Well, how so ... You do not know what CSS ? Absolutely nothing. Where do the data come from, create styles and everything works - Vasily Barbashev
  • one
    Why do you need to change a specific cell in the table? The lines are basically the same, no? This means that each line has a template in which you can set styles, and then on this template and draw all the lines. - Duck Learns to Take Cover
  • Thank you all for your help. Problem solved. - luckydutch

1 answer 1

So create a table manually, register css. When everything is ready, select the data from the database in the array, and then use the foreach output data

 <table> <?php foreach ($rows as $row):?> <tr> <td><?=$row['column']?></td> .......... </tr> <?php endforeach;?> </table> 

And stop using mysql_ * functions. There is a wonderful PDO, mysqli