i've given an abbreviated ex. of a large database (90K records in table 'administrators') from where i'm trying to get data that match with the selected data in the table 'characteristics'. (there are NINE options to work with, i'm just showing one example) - the form fields are all numeralized like the States table below, so i did this little if else statement, but i'm realizing that there must be a reason it was originally built this way, and i'm likely getting into trouble converting values here - i realize i could change the form field values, but again, there must be a reason they're the way they are.
the problem is i need to get the data from 'administrators' and not 'characteristics', probably using "fice", but i don't know how...
help, anyone?
Code: Select all
$aff= $_GET['affiliation'];
$result = mysql_query("SELECT * FROM characteristics WHERE affiliation = '$aff") or die(mysql_error());
echo "These are all the Institutions from ".$aff.":<br><br>";
while($row = mysql_fetch_array( $result )) {
echo $row['abbrev_inst_name']."<br>";
}
Code: Select all
CREATE TABLE administrators (
fice int(11) NOT NULL,
line varchar(3) collate utf8_unicode_ci NOT NULL,
mpc varchar(10) collate utf8_unicode_ci NOT NULL,
title varchar(35) collate utf8_unicode_ci NOT NULL,
name varchar(255) collate utf8_unicode_ci NOT NULL,
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2005 | 1 | 12 | 32 | Professor | Bill Smith
CREATE TABLE characteristics (
fice int(11) NOT NULL,
full_inst_name varchar(100) collate utf8_unicode_ci NOT NULL,
affiliation int(11) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (fice)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2005 | U of Alabama | Alabama
CREATE TABLE rel_affiliation (
affiliation int(3) NOT NULL,
affil_text varchar(255) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (affiliation)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table 'rel_affiliation'
--
INSERT INTO rel_affiliation (affiliation, affil_text) VALUES(26, 'Advent Christian Church');
INSERT INTO rel_affiliation (affiliation, affil_text) VALUES(51, 'African Methodist Episcopal');
INSERT INTO rel_affiliation (affiliation, affil_text) VALUES(24, 'African Methodist Episcopal Zion Church');