=")? " OR dates = DATE('0000-00-00')":"")
.(($sign == "<")? " AND dates != DATE('0000-00-00')":"")
.")"
." ORDER BY dates;";
}
//echo $query,"
";
if ($result = @mysql_query ($query, $db)) {
if ($rows = @mysql_num_rows ($result)) {
$i =0;
while ($row = @mysql_fetch_object ($result)) {
$R['f_id'] = $row->event_id;
$R['f_title'] = $row->title;
$R['f_instruments'] = $row->instrumentation;
$R['f_comp_year'] = $row->year;
$R['f_premiere'] = $row->premiere;
$R['f_performers'] = $row->performers;
$R['f_dates'] = $row->fecha;
$R['f_place'] = $row->place;
$R['f_address'] = $row->address;
$R['f_city'] = $row->city;
$R['f_state'] = $row->state;
$R['f_country'] = $row->country;
$R['f_country_name']= $row->country!="0"?$GLOBALS["country_name"][$row->country]:"";
$R['f_zip'] = $row->zip_code;
$R['f_URL'] = $row->directions;
$R['f_phone'] = $row->phone;
$R['f_other'] = $row->other;
$R['f_day'] = $row->e_day;
$R['f_month'] = $row->e_month;
$R['f_year'] = $row->e_year;
$A[$i] = $R; //utf8_decoder($R);
$i++;
}
return $A;
} else {
return null;
}
} else
echo "ERROR: ",mysql_errno ().' '.mysql_error (),"
";
}
function delete_event ($db, $id) {
$query = "delete from event where event_id = $id ";
//echo "$query
";
if ($resultado = mysql_query ($query, $db)) {
echo '';
} else {
echo "NO BORRE NADA
";
}
}
function html_decoder ($data) {
$data['f_title'] = html_entity_decode($data['f_title'], ENT_QUOTES);
$data['f_instruments'] = html_entity_decode($data['f_instruments'], ENT_QUOTES);
$data['f_comp_year'] = html_entity_decode($data['f_comp_year'], ENT_QUOTES);
$data['f_premiere'] = html_entity_decode($data['f_premiere'], ENT_QUOTES);
$data['f_performers'] = html_entity_decode($data['f_performers'], ENT_QUOTES);
$data['f_place'] = html_entity_decode($data['f_place'], ENT_QUOTES);
$data['f_address'] = html_entity_decode($data['f_address'], ENT_QUOTES);
$data['f_city'] = html_entity_decode($data['f_city'], ENT_QUOTES);
$data['f_state'] = html_entity_decode($data['f_state'], ENT_QUOTES);
$data['f_zip'] = html_entity_decode($data['f_zip'], ENT_QUOTES);
$data['f_country'] = html_entity_decode($data['f_country'], ENT_QUOTES);
$data['f_URL'] = html_entity_decode($data['f_URL'], ENT_QUOTES);
$data['f_phone'] = html_entity_decode($data['f_phone'], ENT_QUOTES);
$data['f_other'] = html_entity_decode($data['f_other'], ENT_QUOTES);
return $data;
}
function html_encoder ($data) {
$data['f_title'] = htmlentities($data['f_title'], ENT_QUOTES);
$data['f_instruments'] = htmlentities($data['f_instruments'], ENT_QUOTES);
$data['f_comp_year'] = htmlentities($data['f_comp_year'], ENT_QUOTES);
$data['f_premiere'] = htmlentities($data['f_premiere'], ENT_QUOTES);
$data['f_performers'] = htmlentities($data['f_performers'], ENT_QUOTES);
$data['f_place'] = htmlentities($data['f_place'], ENT_QUOTES);
$data['f_address'] = htmlentities($data['f_address'], ENT_QUOTES);
$data['f_city'] = htmlentities($data['f_city'], ENT_QUOTES);
$data['f_state'] = htmlentities($data['f_state'], ENT_QUOTES);
$data['f_zip'] = htmlentities($data['f_zip'], ENT_QUOTES);
$data['f_country'] = htmlentities($data['f_country'], ENT_QUOTES);
$data['f_URL'] = htmlentities($data['f_URL'], ENT_QUOTES);
$data['f_phone'] = htmlentities($data['f_phone'], ENT_QUOTES);
$data['f_other'] = htmlentities($data['f_other'], ENT_QUOTES);
return $data;
}
function utf8_encoder ($data) {
$data['f_title'] = utf8_encode($data['f_title']);
$data['f_instruments'] = utf8_encode($data['f_instruments']);
$data['f_comp_year'] = utf8_encode($data['f_comp_year']);
$data['f_premiere'] = utf8_encode($data['f_premiere']);
$data['f_performers'] = utf8_encode($data['f_performers']);
$data['f_place'] = utf8_encode($data['f_place']);
$data['f_address'] = utf8_encode($data['f_address']);
$data['f_city'] = utf8_encode($data['f_city']);
$data['f_state'] = utf8_encode($data['f_state']);
$data['f_zip'] = utf8_encode($data['f_zip']);
$data['f_URL'] = urlencode($data['f_URL']);
$data['f_phone'] = utf8_encode($data['f_phone']);
$data['f_other'] = utf8_encode($data['f_other']);
return $data;
}
function utf8_decoder ($data) {
$data['f_title'] = utf8_decode($data['f_title']);
$data['f_instruments'] = utf8_decode($data['f_instruments']);
$data['f_comp_year'] = utf8_decode($data['f_comp_year']);
$data['f_premiere'] = utf8_decode($data['f_premiere']);
$data['f_performers'] = utf8_decode($data['f_performers']);
$data['f_place'] = utf8_decode($data['f_place']);
$data['f_address'] = utf8_decode($data['f_address']);
$data['f_city'] = utf8_decode($data['f_city']);
$data['f_state'] = utf8_decode($data['f_state']);
$data['f_zip'] = utf8_decode($data['f_zip']);
$data['f_URL'] = urldecode($data['f_URL']);
$data['f_phone'] = utf8_decode($data['f_phone']);
$data['f_other'] = utf8_decode($data['f_other']);
return $data;
}
function slash_encoder ($data) {
$data['f_title'] = addslashes($data['f_title']);
$data['f_instruments'] = addslashes($data['f_instruments']);
$data['f_comp_year'] = addslashes($data['f_comp_year']);
$data['f_premiere'] = addslashes($data['f_premiere']);
$data['f_performers'] = addslashes($data['f_performers']);
$data['f_place'] = addslashes($data['f_place']);
$data['f_address'] = addslashes($data['f_address']);
$data['f_city'] = addslashes($data['f_city']);
$data['f_state'] = addslashes($data['f_state']);
$data['f_zip'] = addslashes($data['f_zip']);
// $data['f_URL'] = urlencode($data['f_URL']);
$data['f_phone'] = addslashes($data['f_phone']);
$data['f_other'] = addslashes($data['f_other']);
//echo "REQUEST: ",$data['f_title'], "
";
return $data;
}
function insert_event ($db, $R) {
$R = slash_encoder ($R);
$R = utf8_encoder ($R);
$query = "insert into event (";
$query.= "title, ";
$query.= "instrumentation, ";
$query.= "year, ";
$query.= "premiere, ";
$query.= "performers, ";
$query.= "dates, ";
$query.= "place, ";
$query.= "address, ";
$query.= "city, ";
$query.= "state, ";
$query.= "country, ";
$query.= "zip_code, ";
$query.= "directions, ";
$query.= "phone, ";
$query.= "other ";
$query.= ") values (";
$query.= $R['f_title']==""? "null,": "'".$R['f_title']."',";
$query.= $R['f_instruments']==""?"null,":"'".$R['f_instruments']."',";
$query.= $R['f_comp_year']==""? "null,":$R['f_comp_year'].",";
$query.= $R['f_premiere']==""? "null,":"'".$R['f_premiere']."',";
$query.= $R['f_performers']==""? "null,":"'".$R['f_performers']."',";
$query.= $R['f_day']&&$R['f_month']&&$R['f_year']?
sprintf ("'%04d-%02d-%02d',",$R['f_year'],$R['f_month'],$R['f_day']):"'0000-00-00',";
$query.= $R['f_place']==""? "null,":"'".$R['f_place']."',";
$query.= $R['f_address']==""? "null,":"'".$R['f_address']."',";
$query.= $R['f_city']==""? "null,":"'".$R['f_city']."',";
$query.= $R['f_state']==""? "null,":"'".$R['f_state']."',";
$query.= $R['f_country']==""? "null,":"'".$R['f_country']."',";
$query.= $R['f_zip']==""? "null,":"'".$R['f_zip']."',";
$query.= $R['f_URL']==""? "null,":"'".$R['f_URL']."',";
$query.= $R['f_phone']==""? "null,":"'".$R['f_phone']."',";
$query.= $R['f_other']==""? "null)":"'".$R['f_other']."')";
if ($resultado = mysql_query ($query, $db)) {
echo "\n";
} else {
echo '';
echo "Insert Failure for: ", $R['f_title'], ', ', $R['f_instruments'], ', ', $R['f_comp_year'],', ', $R['f_performers'],mysql_errno ().' '.mysql_error ().'
';
//echo "QUERY = $query
";
echo '';
}
}
function update_event ($db, $R) {
$R = html_decoder ($R);
$R = slash_encoder ($R); // echo "SLASH: ",$R['f_title'],"
";
$R = utf8_encoder ($R); // echo "UTF8: ",$R['f_title'],"
";
$query = "update event set ";
$query.= "title = ";
$query.= $R['f_title']==""? "null,": "'".$R['f_title']."',";
$query.= "instrumentation = ";
$query.= $R['f_instruments']==""?"null,":"'".$R['f_instruments']."',";
$query.= "year = ";
$query.= $R['f_comp_year']==""? "null,":$R['f_comp_year'].",";
$query.= "premiere = ";
$query.= $R['f_premiere']==""? "null,":"'".$R['f_premiere']."',";
$query.= "performers = ";
$query.= $R['f_performers']==""? "null,":"'".$R['f_performers']."',";
$query.= "dates = ";
$query.= $R['f_day']&&$R['f_month']&&$R['f_year']?
sprintf ("'%04d-%02d-%02d',",$R['f_year'],$R['f_month'],$R['f_day']):"'0000--00-00',";
$query.= "place = ";
$query.= $R['f_place']==""? "null,":"'".$R['f_place']."',";
$query.= "address = ";
$query.= $R['f_address']==""? "null,":"'".$R['f_address']."',";
$query.= "city = ";
$query.= $R['f_city']==""? "null,":"'".$R['f_city']."',";
$query.= "state = ";
$query.= $R['f_state']==""? "null,":"'".$R['f_state']."',";
$query.= "country = ";
$query.= $R['f_country']==""? "null,":"'".$R['f_country']."',";
$query.= "zip_code = ";
$query.= $R['f_zip']==""? "null,":"'".$R['f_zip']."',";
$query.= "directions = ";
$query.= $R['f_URL']==""? "null,":"'".$R['f_URL']."',";
$query.= "phone = ";
$query.= $R['f_phone']==""? "null,":"'".$R['f_phone']."',";
$query.= "other = ";
$query.= $R['f_other']==""? "null ":"'".$R['f_other']."' ";
$query.= "where event_id = ".$R['f_id'];
//echo "QUERY of update: $query
";
if ($resultado = mysql_query ($query, $db)) {
echo "";
} else {
echo '';
echo "Update Failure: {$R['f_title']}, {$R['f_instruments']}, {$R['f_comp_year']}, {$R['f_performers']}, ", mysql_errno ().' - '.mysql_error ().'
';
echo '';
echo '';
}
}
// ------------------- HERE IT MAKES THE EVENTS DISPLAY -------------------
function make_div ($db_ptr, $sign, $visible, $div_name, $country_name) {
$status = array("N"=>"None","L"=>"Local Premiere","M"=>"Mundial Premiere");
$A = read_events ($db_ptr, 0, $sign);
$size = sizeof($A);
if ($size > 0) {
printf ("
\n"); printf (" \n"); printf (" \n"); printf (" %s Events\n", ucwords ($div_name)); printf (" \n"); if ($div_name == "Past") { printf (" \n"); printf (" \n"); printf (" \n"); printf (" \n"); } printf (" \n"); printf ("
"; echo "
|
dana richardson
|
|||||
|
||||||
|
||||||
|