$dbuser = 'biocompuser';
$dbpass = '';
$dbhost = 'biocomplexity.indiana.edu';
function db_connect ($dbhost, $dbuser, $dbpass) {
if (!@mysql_connect($dbhost, $dbuser, $dbpass)) {
die('Unable to connect to database:
' . mysql_error());
}
if (!@mysql_select_db('biocomp')) {
die('Error - could not select the database.');
}
}
$table = 'wsreg';
// connect ####################################
db_connect($dbhost, $dbuser, $dbpass);
$sql = mysql_query("SELECT UserID, FName, MName, LName, Prefix, Suffix, Institution, Department, Address1, Address2, Address3, City, State, PostalCode, Country, Telephone, Fax, Email, Poster, Postertitle, Prtitle, Prabstract, Jpaper, Jpapertitle, Support, Sex, Ethnicity, FoodPref, TravelPlan, OtherNeeds, ParticipantStatus, PubPref, PubInfo, ParticipantPosition, Banquet FROM $table ORDER BY LName ASC");
while ($data = mysql_fetch_array($sql)) {
// name
$name = '';
if(@$data['Prefix']) {
$name .= stripslashes($data['Prefix']) . ' ';
}
if(@$data['FName']) {
$name .= stripslashes($data['FName']) . ' ';
}
if(@$data['MName']) {
$name .= stripslashes($data['MName']) . ' ';
}
if(@$data['LName']) {
$name .= stripslashes($data['LName']);
}
if(@$data['Suffix']) {
$name .= ' ' . stripslashes($data['Suffix']);
}
// #####################
// affiliation
$aff = '
';
if(@$data['Department']) {
$aff .= stripslashes($data['Department']) . "
";
}
if(@$data['Institution']) {
$aff .= stripslashes($data['Institution']) . '
';
}
// address
$addr = '';
if(@$data['Address1']) {
$addr .= stripslashes($data['Address1']) . "
";
}
if(@$data['Address2']) {
$addr .= stripslashes($data['Address2']) . "
";
}
if(@$data['Address3']) {
$addr .= stripslashes($data['Address3']) . "
";
}
if(@$data['City']) {
$addr .= stripslashes($data['City']) . ' ';
}
if(@$data['State']) {
$addr .= stripslashes($data['State']) . ' ';
}
if(@$data['PostalCode']) {
$addr .= stripslashes($data['PostalCode']) . '
';
}
if(@$data['Country']) {
$addr .= stripslashes($data['Country']) . '
';
}
// ##########################
// other contact information
$othercontact = '';
if(@$data['Telephone']) {
$othercontact .= 'tel: ' . $data['Telephone'] . "
";
}
if(@$data['Fax']) {
$othercontact .= 'fax: ' . $data['Fax'] . "
";
}
//
if($data['PubPref'] == 'y') {
echo $name . $aff . $addr . $othercontact . $data['Email'];
}
elseif($data['PubPref'] == 'o') {
echo $name . $aff . $data['Email'];
}
elseif($data['PubPref'] == 'n') {
echo nl2br($data['PubInfo']);
}
else {
echo $name . $aff . $data['Email'];
}
echo '
';
}
?>