I have a large database with 11,000 items and growing. Unfortunately, there have been lots of changes over the last 3 years. There are now 61 columns in one particular table. There are a number of variables that reference other tables. Examples: there are at least 10 items that reference tables with at least 12 items each. The main table will simply reference the ID number on the other table.
My main issue is converting these IDs to text when I try to export to screen or Excel. It takes WAY too long. I have small (I think) functions that convert the ID number from the main table to the text in the referenced table:
function getLocation($requiredData) {
$result = mysql_query("SELECT * FROM site_location WHERE id = '$requiredData'") or die(mysql_error());
while($row = mysql_fetch_array($result)) {
return $row['value'];
}
}
Now when I try exporting, it has to go through all these lines and convert the items that are referencing the smaller table. Should I run the function once at the beginning, let it create variables and simply replace the ID with the respective text each time it runs across one?
Sorry if this sounds confusing - drinking decaf for some unknown reason right now.