There was a huge code sheet and a screenshot that had nothing to do with the SQL error. Because of this, the actual errors were not visible. Problem code and error text left ( @Khvorostin )

<?php $pos = mysql_query( "SELECT `признак_посещения` WHERE 'фио_студента' == $stud_array[$f] AND 'имя_работы' == $work_array[$t] ") or die( mysql_error() ); ?> 

gives out

 > You have an error in your SQL syntax; > check the manual that corresponds to > your MySQL server version for the > right syntax to use near 'where > 'фио_студента'==Исаев Алексей and > 'имя_раб' at line 1 

    2 answers 2

    Formally speaking, this will work.

    But anyone familiar with databases will spit on this code: accessing the database is “expensive” (that is, it takes a lot of time and system resources). Therefore, it is better to make one request that will give you all the necessary data at once, and then disassemble it into your data structures.

    • You have an error in your SQL syntax; Check out the manual for the right syntax to use near where the student’s name = Alexei Isaev and the name of the administrator at line 1 what’s wrong = (? I updated the code in questionStein_
    • I mean the theoretical possibility. It is clear that you need to fix the syntax first. - VladD
    • excuse me. How correct is the syntax? - Stein_

    'student's name' == Alexey Isaev

    1. not ==, but =
    2. text is not quoted

    General remark. Do not be ashamed to show such govnokod?

    1. echo where not necessary, a wild mix of HTML, PHP and SQL
    2. multiple database queries within one page, SQL queries in a loop
    3. SQL queries like SELECT * FROM
    4. mess in the design - crooked indents, lack of unity in the design of the code: the first request is in a separate variable, the other three are not
    5. Something like compiled tables, lost <tr> tags, unclosed tags, nested tables where it is not needed.

    all this, at least, disrespect for those who see your code.

    Try this:

    • The only query to the database.
    • Data processing, the results are added to the array.
    • The output of the results. Maximum HTML, minimum PHP (only foreach ... , no echo )