It is possible to create a loop so that css styles are applied to the data from mysql. Here is a sample code:

<div id="topContainer"><? do { echo $result->fetch_assoc; echo '<p>Name: <b>'.$rows['name'].'</b></p>'; echo '<p>Year: <b>'.$rows['year'].'</b></p>'; } while ($rows=$result->fetch_assoc()); ?></p> </div> 

For data that is displayed for the first time, css styles are applied, and the rest are already without styles, how can you make it apply to this style too?

  • you do not have classes on these elements, could you show your css which affects these elements? - sivik_xes
  • @sivik_xes #topContainer {font-size: 1.3em; text-align: center; padding: 6px; background: #red; } - Jasonartok
  • one
    Do you have an extra closing after while? </ P> try to remove - sivik_xes
  • one
    Well, it is wrong to use the do-while syntax. In this situation, it is better to just while . - borodatych
  • it turned out to loop, but the php code is applied only to one style css <div id = "topContainer"> and I have more, i.e. I have a block, there are more blocks in it, and they have their own styles, layout, here it does not work, i.e. php code sees only one block. And I have <div id = "topContainer"> over <div id = "container"> - Jasonartok

0