|
// 29.01.2k1
// Norbert Math, IEM
// functions for reading data
//<--------------------- get xternals ----------------------------->
function get_ext($ext_name, $ext_desc) {
// if ($ext_name !="")
$query ="select * from External where External_Name like '%$ext_name%'";
if ($ext_desc !="")
$query ="select * from External where External_Description like '%$ext_desc%'";
/*
print " ";
print $query;
print " ";
*/
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
// if ($ext_name !="")
print " Search for Externals by name like $ext_name returned
$num_of_rows Externals. ";
if ($ext_desc !="")
print " Search for Externals by description like $ext_desc returned
$num_of_rows Externals. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$External_ID[$n]=$row[0];
$Author_ID[$n]=$row[1];
$External_Name[$n]=$row[2];
$External_Description[$n]=$row[3];
$URL_ID[$n]=$row[4];
$Library_ID[$n]=$row[5];
$HelpPatch[$n]=$row[6];
$Type[$n]=$row[7];
$n++;
}
// make an array of $Author_name[$Author_ID] end populate it by mysql
while ($Author_ID[$m]) {
$query ="select Author from Author where Author_ID = '$Author_ID[$m]'";
//print $query;
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($num_of_rows != 1 ) print "
WARNING: got $num_an_of_rows Author Names. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Author_Name[$Author_ID[$m]]=$row[0];
}
$m++;
}
// and now for the URLs
while ($URL_ID[$z]) {
$query ="select Download,Documentation from URL where URL_ID = '$URL_ID[$z]'";
//print $query;
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($num_of_rows != 1 ) print "
WARNING: got $num_an_of_rows URLs. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Download[$URL_ID[$z]]=$row[0];
$Documentation[$URL_ID[$z]]=$row[1];
}
$z++;
}
// Library
while ($Library_ID[$y]) {
$query ="select Library_Name from Library where Library_ID = '$Library_ID[$y]'";
//print $query;
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($num_of_rows != 1 ) print "
WARNING: got $num_an_of_rows Libraries. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Library_Name[$Library_ID[$y]]=$row[0];
}
$y++;
}
// print the whole thing
echo ' ';
while ($External_ID[$p]) {
echo '
';
print " Name: ".$External_Name[$p]."
Author: ".$Author_Name[$Author_ID[$p]]."
Library: ".$Library_Name[$Library_ID[$p]]."
Description: ".$External_Description[$p]."
Download: ".
$Download[$URL_ID[$p]]."
Documentation: ".
$Documentation[$URL_ID[$p]]."";
echo ' | ';
$p++;
}
echo ' ';
}
// <----------------------get libs ---------------------->
function get_lib($lib_name, $lib_desc) {
if ($lib_name !="")
$query ="select * from Library where Library_Name like '%$lib_name%'";
if ($lib_desc !="")
$query ="select * from Library where Library_Description like '%$lib_desc%'";
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($lib_name !="")
print "Search for Libraries by name like $lib_name returned
$num_of_rows Libraries. ";
if ($lib_desc !="")
print " Search for Libraries by description like $lib_desc returned
$num_of_rows Libraries. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Library_ID[$n]=$row[0];
$Author_ID[$n]=$row[1];
$Library_Name[$n]=$row[2];
$Library_Description[$n]=$row[3];
$URL_ID[$n]=$row[4];
$Platform[$n]=$row[5];
$Version[$n]=$row[6];
$n++;
}
// make an array of $Author_name[$Author_ID] end populate it by mysql
while ($Author_ID[$m]) {
$query ="select Author from Author where Author_ID = '$Author_ID[$m]'";
//print $query;
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($num_of_rows != 1 ) print "
WARNING: got $num_an_of_rows Author Names. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Author_Name[$Author_ID[$m]]=$row[0];
}
$m++;
}
// and now for the URLs
while ($URL_ID[$z]) {
$query ="select Download,Documentation from URL where URL_ID = '$URL_ID[$z]'";
//print $query;
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($num_of_rows != 1 ) print "
WARNING: got $num_an_of_rows URLs. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Download[$URL_ID[$z]]=$row[0];
$Documentation[$URL_ID[$z]]=$row[1];
}
$z++;
}
// print the whole lib
echo ' ';
}
//<--------------------- get abs ----------------------------->
function get_abs($abs_name, $abs_desc) {
if ($abs_name !="")
$query ="select * from Abstraction where Abstraction_Name like '%$abs_name%'";
if ($abs_desc !="")
$query ="select * from Abstraction where Abstraction_Description like '%$abs_desc%'";
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($abs_name !="")
print "Search for Abstractions by name like $abs_name returned
$num_of_rows Abstractions. ";
if ($abs_desc !="")
print " Search for Abstractionss by description like $abs_desc returned
$num_of_rows Abstractions. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Abstraction_ID[$n]=$row[0];
$Author_ID[$n]=$row[1];
$Abstraction_Name[$n]=$row[2];
$Abstraction_Description[$n]=$row[3];
$URL_ID[$n]=$row[4];
$Library_ID[$n]=$row[5];
$Help_Patch_URL[$n]=$row[6];
$n++;
}
// make an array of $Author_name[$Author_ID] end populate it by mysql
while ($Author_ID[$m]) {
$query ="select Author from Author where Author_ID = '$Author_ID[$m]'";
//print $query;
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($num_of_rows != 1 ) print "
WARNING: got $num_an_of_rows Author Names. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Author_Name[$Author_ID[$m]]=$row[0];
}
$m++;
}
// and now for the URLs
while ($URL_ID[$z]) {
$query ="select Download,Documentation from URL where URL_ID = '$URL_ID[$z]'";
//print $query;
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($num_of_rows != 1 ) print "
WARNING: got $num_an_of_rows URLs. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Download[$URL_ID[$z]]=$row[0];
$Documentation[$URL_ID[$z]]=$row[1];
}
$z++;
}
// Library
while ($Library_ID[$y]) {
$query ="select Library_Name from Library where Library_ID = '$Library_ID[$y]'";
//print $query;
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($num_of_rows != 1 ) print "
WARNING: got $num_an_of_rows Libraries. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Library_Name[$Library_ID[$y]]=$row[0];
}
$y++;
}
// print ze abs
echo ' ';
while ($Abstraction_ID[$p]) {
echo '
';
print " Name: ".$Abstraction_Name[$p]."
Author: ".$Author_Name[$Author_ID[$p]]."
Library: ".$Library_Name[$Library_ID[$p]]."
Description: ".$Abstraction_Description[$p]."
Download: ".
$Download[$URL_ID[$p]]."
Documentation: ".
$Documentation[$URL_ID[$p]]."";
echo ' | ';
$p++;
}
echo ' ';
}
//<--------------------- get patches ----------------------------->
function get_pat($pat_name, $pat_desc) {
if ($pat_name !="")
$query ="select * from Patch where Patch_Name like '%$pat_name%'";
if ($pat_desc !="")
$query ="select * from Patch where Patch_Description like '%$pat_desc%'";
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($pat_name !="")
print "Search for Patches by name like $pat_name returned
$num_of_rows Patches. ";
if ($pat_desc !="")
print " Search for Patches by description like $pat_desc returned
$num_of_rows Patches. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Patch_ID[$n]=$row[0];
$Author_ID[$n]=$row[1];
$Patch_Name[$n]=$row[2];
$Patch_Description[$n]=$row[3];
$URL_ID[$n]=$row[4];
$Library_ID[$n]=$row[5];
$n++;
}
// make an array of $Author_name[$Author_ID] end populate it by mysql
while ($Author_ID[$m]) {
$query ="select Author from Author where Author_ID = '$Author_ID[$m]'";
//print $query;
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($num_of_rows != 1 ) print "
WARNING: got $num_an_of_rows Author Names. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Author_Name[$Author_ID[$m]]=$row[0];
}
$m++;
}
// and now for the URLs
while ($URL_ID[$z]) {
$query ="select Download,Documentation from URL where URL_ID = '$URL_ID[$z]'";
//print $query;
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($num_of_rows != 1 ) print "
WARNING: got $num_an_of_rows URLs. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Download[$URL_ID[$z]]=$row[0];
$Documentation[$URL_ID[$z]]=$row[1];
}
$z++;
}
// Library
while ($Library_ID[$y]) {
$query ="select Library_Name from Library where Library_ID = '$Library_ID[$y]'";
//print $query;
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
if ($num_of_rows != 1 ) print "
WARNING: got $num_an_of_rows Libraries. ";
while ($row = mysql_fetch_row ($query_result_handle)) {
$Library_Name[$Library_ID[$y]]=$row[0];
}
$y++;
}
// print the whole thing
echo ' ';
while ($Patch_ID[$p]) {
echo '
';
print " Name: ".$Patch_Name[$p]."
Author: ".$Author_Name[$Author_ID[$p]]."
Library: ".$Library_Name[$Library_ID[$p]]."
Description: ".$Patch_Description[$p]."
Download: ".
$Download[$URL_ID[$p]]."
Documentation: ".
$Documentation[$URL_ID[$p]]."";
echo ' | ';
$p++;
}
echo ' ';
}
//<--------------------- get author ----------------------------->
function get_aut($name) {
$query ="select Author_ID,Author from Author where Author like '%$name%'";
$query_result_handle = mysql_db_query("pd", $query);
$num_of_rows = mysql_num_rows($query_result_handle);
print "Search for Author by Name like $name returned
$num_of_rows Authors. ";
// get her ID ... possibly there are more of them!
while ($row = mysql_fetch_row ($query_result_handle)) {
$Author_ID[$n] = $row[0];
$Author_Name[$n] = $row[1];
$n++;
}
// now look what she has done ...
while ($Author_ID[$ai]) {
$query="select Library_Name from Library where Author_ID = '$Author_ID[$ai]'";
$query_result_handle = mysql_db_query("pd", $query);
while ($row = mysql_fetch_row ($query_result_handle)) {
$Library_Name[$l][$Author_ID[$ai]]=$row[0];
$l++;
}
$query="select External_Name from External where Author_ID = '$Author_ID[$ai]'";
$query_result_handle = mysql_db_query("pd", $query);
while ($row = mysql_fetch_row ($query_result_handle)) {
$External_Name[$x][$Author_ID[$ai]]=$row[0];
$x++;
}
$query="select Abstraction_Name from Abstraction where Author_ID = '$Author_ID[$ai]'";
$query_result_handle = mysql_db_query("pd", $query);
while ($row = mysql_fetch_row ($query_result_handle)) {
$Abstraction_Name[$b][$Author_ID[$ai]]=$row[0];
$b++;
}
$query="select Patch_Name from Patch where Author_ID = '$Author_ID[$ai]'";
$query_result_handle = mysql_db_query("pd", $query);
while ($row = mysql_fetch_row ($query_result_handle)) {
$Patch_Name[$pt][$Author_ID[$ai]]=$row[0];
$pt++;
}
$ai++;
}
// print the whole author thing
echo ' ';
}
// <---------------------- check for results ------------------------>
// parse the query
if ($qry) {
$db=mysql_connect("iemdb.iemnet","www","www");
if ($alb) {
if($ext) {
if ($qry == "complete") {
get_ext("","");
}
}
if($lib || $all) get_lib($qry,"");
if($ext || $all) get_ext($qry,"");
if($abs || $all) get_abs($qry,"");
if($pat || $all) get_pat($qry,"");
if($lib || $all) get_lib("",$qry);
if($ext || $all) get_ext("",$qry);
if($abs || $all) get_abs("",$qry);
if($pat || $all) get_pat("",$qry);
}
else if($nam) {
if($lib || $all) get_lib($qry,"");
if($ext || $all) get_ext($qry,"");
if($abs || $all) get_abs($qry,"");
if($pat || $all) get_pat($qry,"");
}
else if($des) {
if($lib || $all) get_lib("",$qry);
if($ext || $all) get_ext("",$qry);
if($abs || $all) get_abs("",$qry);
if($pat || $all) get_pat("",$qry);
}
if($aut) {
get_aut($qry);
}
mysql_close($db);
} else echo '
Notes:
You can put only one single word into the search string field. This word can be a substring of what you search, e.g. "ex" will give you both "zexy" and "ggext".
Do not forget to check a category (Library, External, Abstraction). Multiple choices are allowed.
Author search: just check the "Author" box and fill in a searchstring.
';
?>
Found an error? Your entry is missing? please contact me, <math at iem.at>
|