Book query section:
<?
If (! $ UploadAction ):
?>
<?
// This program is used to output the title, author, and Publisher Information.
// Editor: Kong xiuxiang. Date: 2001/3/25
?>
<HTML> <HEAD>
<TITLE> bibliography query </TITLE>
</HEAD>
<BODY> <TABLE align = CENTER>
<Form enctype = "multipart/form-data" NAME = "SubmitForm"
ACTION = "<? $ PHP_SELF?> "METHOD =" POST ">
<Input type = "hidden" NAME = "MAX_FILE_SIZE" VALUE = "20000000">
<Input type = "hidden" NAME = "UploadAction" VALUE = "1">
<! -- TR> <TD> file NAME <TD> <input name = "UploadFile" TYPE = "file" VALUE = "" SIZE = "30"> </TR -->
<TR> <TD align = center> book NAME <TD> <input name = "B _name" TYPE = "text" VALUE = "" SIZE = "30" maxlength = 100> </TD> </TR>
<TR> <TD align = center> author <TD> last NAME <input name = "a_first1" TYPE = "text" VALUE = "" SIZE = "6" maxlength = 20>
<Input name = "a_last1" TYPE = "text" VALUE = "" SIZE = "6" maxlength = 20> </TD> </TR>
<TR> <TD align = center> press <TD> <input name = "p_name" TYPE = "text" VALUE = "" SIZE = "30" maxlength = 100> </ TD> </TR>
<TR> <TD> publication date <TD> <input name = "p_year" TYPE = "text" VALUE = "" SIZE = "4"> year
<! -- Input name = "p_month" TYPE = "text" VALUE = "" SIZE = "2"> month <-->
<TR> <TD> ISBN <TD> <input name = "isbn" TYPE = "text" VALUE = "" SIZE = "25">
</TABLE> <TABLE align = center>
<TR> <TD align = center>
<Input name = "submit" VALUE = "submit" TYPE = "submit">
<TD> <input name = "reset" VALUE = "reset" TYPE = "reset">
</TD> </TR>
</FORM> </CENTER> </TABLE> </BODY>
</HTML>
<?
Else:
Session_start ();
Require "config. php3 ";
$ B _price = $ B _price_a. ".". $ B _price_ B;
$ UploadAction = 0;
$ Repeat = 0; // is the repeat repeated.
$ TimeLimit = 0; // set the time-out period. The default time is 30 seconds. If it is set to 0, the time-out period is not limited.
Set_time_limit ($ TimeLimit );
@ MYSQL_CONNECT ($ hostname, $ dbusername, $ dbpassword) or die ("cannot connect to the database! ");
@ Mysql_select_db ("$ dbname") or die ("You cannot select a database! ");
// $ Q = "select books. books_id, books. books_name, author. first_name, author. last_name, publisher. publisher_name from books, author, books_author, publisher where books. books_name = "$ B _name" and books. publisher_id = publisher. publisher_id and books. books_id = books_author.books_id and books_author.author_id = author. author_id ";
If ($ B _name! = "")
$ Bn = "books. books_name =" $ B _name "and ";
If ($ p_name! = "")
$ Pn = "publisher. publisher_name =" $ p_name "and ";
If ($ a_first1! = "")
$ Af = "author. first_name =" $ a_first1 "and ";
If ($ a_last1! = "")
$ Al = "author. last_name =" $ a_last1 "and ";
If ($ p_year! = ""){
$ Date_p = "books. date_pub rlike '^ $ p_year. *' and ";
}
If ($ isbn! = "")
$ Is = "books. ISBN =" $ isbn "and ";
$ Q = "select books. books_id, books. books_name, author. first_name, author. last_name, publisher. publisher_name from books, author, books_author, publisher
Where $ bn $ pn $ af $ al $ date_p $ is books. publisher_id = publisher. publisher_id and books. books_id = books_author.books_id and books_author.author_id = author. author_id order by books. books_name ";
$ R = @ mysql_query ($ q );
If (! $ R ){
Echo "invalid query <BR> ";
Exit;
}
If (mysql_num_rows ($ r) <1 ){
$ Msg = "no matching record. ";
Xueroom_error_exit ($ msg, $ PHP_SELF );
}
While ($ count = mysql_fetch_array ($ r )){
$ Books_id = $ count [0];
$ Books_name = $ count [1];
$ First_name = $ count [2];
$ Last_name = $ count [3];
$ Publisher_name = $ count [4];
If ($ book! = $ Books_id ){
$ Repeat ++;
Echo "<BR>". $ repeat .",";
Echo ". $ books_name." ";
Echo "Press:". $ count [4];
Echo "Author :";
}
Echo "$ first_name $ last_name ";
$ Book = $ books_id;
}
Echo "<BR> <a href = $ PHP_SELF> return </A> ";
Echo "</BODY> </HTML> ";
?>
<?
Endif;
?>