rocknbil - 4:46 pm on Mar 23, 2011 (gmt 0)
Is it always the same category? I'd check this:
$query = "SELECT * FROM category WHERE cDisplay = 'Yes' ORDER BY cLabel";
because 'Yes', 'yes', ' yes', ' Yes' . . . are all distinctly different values. This would be much more efficient as a boolean or tinyint field (and eliminate this possibility as a culprit,) then you just do . . .
$YesNos = Array('No','Yes');
echo "Display? " . $YesNos[$row['cDisplay']];
The same concept - both of them - applies here, and in addition that you should be storing ID for category in the files table instead of the category name. Numeric lookups will **always** be faster than text matches.
$cat_id = $row['id'];
$result2 = mysql_query("SELECT * FROM files WHERE file_display='Yes' AND file_catname='$cat_id' ORDER BY file_label ASC");
I don't see any other reason with what you posted . . .