There is a code that takes data from the table_prefix . files table table_prefix . files table_prefix . files . And in this table there is a cell file_number , I need to output its value lower in the condition, but it is not displayed if I write {if $file_number > 2} <br /> {/if} , but {if $comment_id > 2} <br /> {/if} everything will work as it should, but you need exactly $file_number . Probably, you need to pull out this value in the lower code.

 if ($upload_link=='story') $sql = "SELECT a.*, b.file_fields AS `fields`, '' AS link_name FROM " . table_prefix . "files a LEFT JOIN " . table_prefix . "files b ON a.file_orig_id=b.file_id WHERE a.file_size='$upload_defsize' AND a.file_comment_id='{$this->_vars['comment_id']}' $hide_sql ORDER BY file_number"; elseif ($upload_link=='orig') $sql = "SELECT a.*, b.file_fields AS `fields`, IF(LEFT(b.file_name,4)='http',b.file_name,CONCAT('$upload_directory/',b.file_name)) AS link_name FROM " . table_prefix . "files a LEFT JOIN " . table_prefix . "files b ON a.file_orig_id=b.file_id WHERE a.file_size='$upload_defsize' AND a.file_comment_id='{$this->_vars['comment_id']}' $hide_sql ORDER BY file_number"; else $sql = "SELECT a.*, c.file_fields AS `fields`, CONCAT('$upload_thdirectory/',b.file_name) AS link_name FROM " . table_prefix . "files a LEFT JOIN " . table_prefix . "files b ON a.file_orig_id=b.file_orig_id AND b.file_size='$upload_link' LEFT JOIN " . table_prefix . "files c ON a.file_orig_id=c.file_id WHERE a.file_size='$upload_defsize' AND a.file_comment_id='{$this->_vars['comment_id']}' $hide_sql ORDER BY file_number"; $images = $db->get_results($sql,ARRAY_A); 
  • @GreenMonster, I did not understand anything. How is the task related to mysql? All requests have a file_number at the output. And in fact - redo the base already, renaming the attributes and removing their prefix file_ . In queries, it is clear that they refer to files ( files.name instead of files.file_name ). - stck
  • @stic, you are strange, since they did not understand. There you need to do another query using LEFT JOIN. For example, "LEFT JOIN". table_prefix. "files b / c / d / or something else." I can't do it right, so I ask for this - how to make a request correctly. - gm-111
  • "redo the base already, renaming the attributes" I also need old queries. - gm-111
  • I also think that the problem is not mysql. I would venture to suggest that if $ file_number> 2 is "not displayed" because the number in $ file_number is less than or equal to 2. - kirill mazurik
  • Conducted a lot of tests. There were options where the number is greater than or equal to 2. - gm-111

0