Home>

We derive data from the database to the table by coordinates (in your cell), if there are no records with a certain coordinate, then X is displayed, the problem is that if more than 1 records are recorded, then the Xers are duplicated, as I understand the table must be overwritten and not be completed, how can I fix? Table from above with 1 entry in the database, from two, the table size of the table is specified by the user

<
? php.
For ($ TR= 1; $ TR <
= $ _ Session ['account'] ['rows']; $ TR ++) {
  Echo '<
TR >
';
    For ($ TD= 1; $ TD <
= $ _ Session ['Account'] ['columns']; $ TD ++) {
     Foreach ($ Temp AS $ Val) {
        Echo '<
TD Class= "TableEnd-Item" >
';
           if ($ tr== $ Val ['x'] and $ td== $ Val ['y']) {
              Echo '<
Div >
≪
P >
2 <
/P >
 ≪
span >
≪
/span >
 ≪
p class= "Tablelast-Main__TD__ACCESS" >
'. $ VAL [' chain0_temp ']. '≪
/P >
≪
/TD >
';
           } ELSE {
              Echo '<
Div >
≪
P >
X <
/P >
 ≪
span >
≪
/span >
 ≪
p class= "Tablelast-Main__TD__ACCESS" >
X <
/P >
≪
/TD >
';
           }
     }
  }
              Echo '<
/TR >
';
 }
? ≫

Data from database:

Array (2) {
  [0]= >
  Array (3) {
    ["x"]= >
    String (1) "2"
    ["Y"]= >
    String (1) "2"
    ["chain0_temp"]= >
    String (2) "69"
  }
   [1]= >
  Array (3) {
    ["x"]= >
    String (1) "1"
    ["Y"]= >
    String (1) "1"
    ["chain0_temp"]= >
    String (2) "69"
  }
 }

Show data and format the code for human.

nazarpunk2021-09-17 09:42:11

@Nazarpunk, I apologize for the code, updated the record

Лысенко Владимир2021-09-17 09:42:11

$ TR== $ VAL ['X'] you have x vertically?

nazarpunk2021-09-17 09:42:11

@Nazarpunk, yes, vertically

Лысенко Владимир2021-09-17 09:42:11