I've been puzzling for 3 days already, tried everything (LEFT JOIN, etc.).

The bottom line is a while loop that prints all the data from mysql from the zvonki table. In the end, everything is displayed in a table format, as needed. I can edit each cell with x-editable.

The question is, there is a napravlenie table, this table has a list of acceptable values. That is, in 1 cell I want to prohibit adding chaotic values, so I entered valid values ​​in the napravlenie table. When adding a record to the table, everything works fine, using a while loop, I output all the values ​​in select / option. But it is necessary for me, that and at editing it would give out values ​​only from the napravlenie table.

As a result, my logic looks like this:

$result = mysqli_query($link, 'SELECT * FROM zvonki ORDER BY id DESC') $result2 = mysqli_query($link, "SELECT * FROM napravlenie") while( $row = mysqli_fetch_assoc($result) ){ ... while( $row2 = mysqli_fetch_assoc($result2) ){ .... } ... } 

The cycle is interrupted when it comes to 2 cycles

  • As a result, the cycle is executed and interrupted on the 2nd cycle. - Kirill Dmitrievich
  • mysqli_query($link, "SELECT * FROM napravlenie"); will choose the same thing . There is absolutely no point in doing this in a loop. - u_mulder
  • And your problem is that you redefine the $result variable. - u_mulder
  • There is absolutely no point in doing this in a cycle - I didn’t quite understand what you mean. I think you misunderstood the idea. - Kirill Dmitrievich
  • And your problem is that you redefine the $ result variable — that's not the point, since here I quickly put it in, before that all the variables were unique everywhere, in the 2nd cycle there was a variable not $ result, but $ result2. - Kirill Dmitrievich

0