图书管理程序(二)_PHP
图书目录输入部分:
if(!$UploadAction):
?>
//本程序是为输入书名,作者、出版社资料而设。
//编者:孔秀祥。日期:2001/3/24
/*
session_start();
if (!isset($auth_passed)) {
echo "本功能只有授权用户才能使用。";
return -1;
}
if(isset($u_name)) {
session_name($u_name);
//echo "
//echo "
";
}
*/
?>
|
|
else:
session_start();
require "config.php3";
$b_price=trim($b_price_a)."\.".trim($b_price_b);
if(strlen($p_month)==1)
$p_month="0".trim($p_month);
if($p_month=="")
$p_month="01";
$date_pub=trim($p_year)."-".trim($p_month)."-01";
$UploadAction=0;
$repeat=0; //是不是重复了。
$TimeLimit=0; //设置超时限制时间缺省时间为 30秒设置为0时为不限时
set_time_limit($TimeLimit);
@MYSQL_CONNECT($hostname,$dbusername,$dbpassword) OR DIE("不能连接数据库!");
@mysql_select_db("$dbname") or die("不能选择数据库!");
//$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";
$b_name=trim($b_name);
$sele="select books.books_id, books.books_name,author.first_name,author.last_name,publisher.publisher_name,books.ISBN,books.price,books.date_pub,books.pages";
$fro=" from books,author,books_author,publisher ";
if(trim($isbn)!="")
$whe="where books.ISBN=\"$isbn\" ";
elseif(trim($a_first1)!="" && trim($a_last1)!="" && trim($p_name)!="")
$whe=" 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";
else{
$msg="书名为必填,其他如果ISBN为空,则作者的姓、名,出版社为必填。
请检查是否符合要求。";
xueroom_error_exit($msg,$PHP_SELF);
}
$q="$sele$fro$whe";
/*
books.books_id,
books.books_name,
author.first_name,
author.last_name,
publisher.publisher_name
books.ISBN,
books.price,
books.date_pub,
books.pages
*/
$r = @mysql_query($q);
// $count=@mysql_fetch_row($r);
// echo "书名".$count[1]."
";
if(!$r){
echo "查询无效
";
exit;
}
if(mysql_num_rows($r)){
if(trim($isbn)!=""){
echo "数据重复。
";
exit;
}
else
while($count=mysql_fetch_array($r)){
/*
echo "while。
";
echo trim($a_first1);
echo trim($count[2]);
echo trim($a_first1)==trim($count[2]);
echo "
";
echo trim($a_last1)==trim($count[3]);
echo "
";
echo trim($p_name)==trim($count[4]);
echo "
";
*/
if( trim($a_first1)==trim($count[2]) && trim($a_last1)==trim($count[3]) && trim($p_name)==trim($count[4])){
$data_exist =1;
$books_id=$count[0];
$books_name=$count[1];
$first_name=$count[2];
$last_name=$count[3];
$repeat=1;
echo "本书已经在数据库中。
";
echo "书名:".$books_name;
echo "
作者:".$first_name.$last_name;
echo "
国标标准书号:".$count[5];
echo "
书价:".$count[6]."元";
echo "
出版日期:".substr($count[7],0,4)."年".substr($count[7],5,2)."月";
if($count[8])
echo "页码:".$count[8]."页";
echo"
返回 ";
//$repeat=0;
exit;
// break;
}
}//while($count=mysql_fetch_array($r)){
}//if(mysql_num_rows($r){
//if(!$repeat){
if($p_name!=""){
$p_name=trim($p_name);
$address=trim($address);
$zipcode=trim($zipcode);
$telephone=trim($telephone);
$telefax=trim($telefax);
$email=trim($email);
$s_publisher="select publisher_id from publisher where publisher_name=\"$p_name\"";
$results1 = @mysql_query($s_publisher);
$count1=mysql_fetch_array($results1);
if(mysql_num_rows($results1) $q_publisher="INSERT INTO publisher (publisher_name, address, zipcode, telephone, telefax, email) VALUES (\"$p_name\", \"$address\", \"$zipcode\", \"$telephone\", \"$telefax\", \"$email\")";
$result2 = @mysql_query($q_publisher);
if($result2){
$publisher_id= mysql_insert_id();
}
}
else
$publisher_id= $count1[0];
}
if($b_name==""){
echo"书名不能为空。";
exit;
}
else{
$b_name=trim($b_name);
$publisher_id=trim($publisher_id);
// $date_pub=trim($date_pub);
$type=trim($type);
$pages=trim($pages);
// $b_price=trim();
$isbn=trim($isbn);
$s_books="select books_id from books where books_name=\"$b_name\" ";
$results3 = @mysql_query($s_books);
$count3=mysql_fetch_array($results3);
if(mysql_num_rows($results3) $q_books="INSERT INTO books (books_name, publisher_id, date_pub, type, pages, price,ISBN) VALUES (\"$b_name\", \"$publisher_id\", \"$date_pub\", \"$type\", \"$pages\", \"$b_price\",\"$isbn\")";
$result3 = @mysql_query($q_books);
if($result3){
$books_id= mysql_insert_id();
}
}
else
$books_id=$count3[0];
}
if(($a_first1=="")||($a_last1=="")){
echo"第一作者的姓名不能为空。";
//exit;
}
else{
$a_first1=trim($a_first1);
$a_last1=trim($a_last1);
$address=trim($address);
$zipcode=trim($zipcode);
$telephone=trim($telephone);
$email=trim($email);
$s_author="select author_id from author where first_name=\"$a_first1\" and last_name=\"$a_last1\"";
$results = @mysql_query($s_author);
$count2=mysql_fetch_array($results);
if(mysql_num_rows($results) $q_author="INSERT INTO author (first_name, last_name, address, zipcode, telephone, email) VALUES (\"$a_first1\", \"$a_last1\", \"$address\", \"$zipcode\", \"$telephone\", \"$email\")";
$result1 = @mysql_query($q_author);
if($result1){
$author_id= mysql_insert_id();
}
}
else
$author_id =$count2[0];
if($books_id!=""||$author_id!=""){
$s_ba="select id from books_author where books_id=\"$books_id\" and author_id=\"$author_id\"";
$resulta = @mysql_query($s_ba);
//$counta=mysql_fetch_array($resulta);
if(mysql_num_rows($resulta) $q_books_author="INSERT INTO books_author (books_id, author_id, author_type) VALUES (\"$books_id\", \"$author_id\", \"$author_type\")";
$author_id="";
$resulta = @mysql_query($q_books_author);
}
}
}
if(($a_first2!="")||($a_last2!="")){
$a_first2=trim($a_first2);
$a_last2=trim($a_last2);
$s_author2="select author_id from author where first_name=\"$a_first2\" and last_name=\"$a_last2\"";
$results5 = @mysql_query($s_author2);
$count5=mysql_fetch_array($results5);
if(mysql_num_rows($results5) $q_author2="INSERT INTO author (first_name, last_name, address, zipcode, telephone, email) VALUES (\"$a_first2\", \"$a_last2\", \"$address\", \"$zipcode\", \"$telephone\", \"$email\")";
$result2 = @mysql_query($q_author2);
if($result2){
$author_id= mysql_insert_id();
}
}
else
$author_id =$count5[0];
if($books_id!=""||$author_id!=""){
$s_ba="select id from books_author where books_id=\"$books_id\" and author_id=\"$author_id\"";
$resulta = @mysql_query($s_ba);
//$counta=mysql_fetch_array($resulta);
if(mysql_num_rows($resulta) $q_books_author="INSERT INTO books_author (books_id, author_id, author_type) VALUES (\"$books_id\", \"$author_id\", \"$author_type\")";
$author_id="";
$resulta = @mysql_query($q_books_author);
}
}
}
if(($a_first3!="")||($a_last3!="")){
$a_first3=trim($a_first3);
$a_last3=trim($a_last3);
$s_author3="select author_id from author where first_name=\"$a_first3\" and last_name=\"$a_last3\"";
$results6 = @mysql_query($s_author3);
$count6=mysql_fetch_array($results6);
if(mysql_num_rows($results6) $q_author3="INSERT INTO author (first_name, last_name, address, zipcode, telephone, email) VALUES (\"$a_first2\", \"$a_last2\", \"$address\", \"$zipcode\", \"$telephone\", \"$email\")";
$result3 = @mysql_query($q_author3);
if($result3){
$author_id= mysql_insert_id();
}
}
else
$author_id =$count6[0];
if($books_id!=""||$author_id!=""){
$s_ba="select id from books_author where books_id=\"$books_id\" and author_id=\"$author_id\"";
$resulta = @mysql_query($s_ba);
//$counta=mysql_fetch_array($resulta);
if(mysql_num_rows($resulta) $q_books_author="INSERT INTO books_author (books_id, author_id, author_type) VALUES (\"$books_id\", \"$author_id\", \"$author_type\")";
$author_id="";
$resulta = @mysql_query($q_books_author);
}
}
}
echo"
返回 ";
echo"

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

熱門話題

iPhone上的預設地圖是Apple專有的地理位置供應商「地圖」。儘管地圖越來越好,但它在美國以外的地區運作不佳。與谷歌地圖相比,它沒有什麼可提供的。在本文中,我們討論了使用Google地圖成為iPhone上的預設地圖的可行性步驟。如何在iPhone中使Google地圖成為預設地圖將Google地圖設定為手機上的預設地圖應用程式比您想像的要容易。請依照以下步驟操作–先決條件步驟–您必須在手機上安裝Gmail。步驟1–開啟AppStore。步驟2–搜尋“Gmail”。步驟3–點選Gmail應用程式旁

在C語言中,if語句通常用於基於單一條件執行特定程式碼區塊。但是,透過使用邏輯運算子(如 &&、|| 和 !),可以組合多個條件來進行判斷。包括使用邏輯與(&&)判斷多個條件、使用邏輯或(||)判斷至少一個條件、使用邏輯非(!)判斷單一條件的否定,以及嵌套if語句和使用括號明確優先權。

C++是一種廣泛使用的程式語言,在編寫倒數計時器方面非常方便且實用。倒數計時程式是一種常見的應用,它能為我們提供非常精確的時間計算和倒數功能。本文將介紹如何使用C++來寫一個簡單的倒數計時程式。實現倒數程序的關鍵就是使用計時器來計算時間的流逝。在C++中,我們可以使用time.h頭檔中的函數來實作計時器的功能。下面是一個簡單的倒數計時程式的程式碼

使用iPhone手機「圖書」App軟體可以閱讀書籍和有聲書、整理書庫以及購買新書,還可以設定閱讀目標以及記錄你想讀和正在閱讀的圖書。打開“圖書”App,輕點或點按“書店”,透過瀏覽找到一本想要讀的書後,點按價格,這本書就會出現在“圖書”App的“書庫”中等待閱讀了。說起來很簡單,也都知道iPhone手機「圖書」App很好用,但其實很多人都會卡在導入圖書這一步,大家可以藉助給iPhone手機「圖書」App導入圖書:一:打開,用數據線將iPhone手機連接至電腦,點選電子書將下載好的書籍匯入電子書中

您的手機中缺少時鐘應用程式嗎?日期和時間仍將顯示在iPhone的狀態列上。但是,如果沒有時鐘應用程序,您將無法使用世界時鐘、碼錶、鬧鐘等多項功能。因此,修復時鐘應用程式的缺失應該是您的待辦事項清單的首位。這些解決方案可以幫助您解決此問題。修復1–放置時鐘應用程式如果您錯誤地從主畫面中刪除了時鐘應用程序,您可以將時鐘應用程式放回原位。步驟1–解鎖iPhone並開始向左側滑動,直到到達「應用程式庫」頁面。步驟2–接下來,在搜尋框中搜尋「時鐘」。步驟3–當您在搜尋結果中看到下方的「時鐘」時,請按住它並

如何利用Redis實現分散式事務管理引言:隨著網際網路的快速發展,分散式系統的使用越來越廣泛。在分散式系統中,事務管理是一項重要的挑戰。傳統的事務管理方式在分散式系統中難以實現,且效率低。而利用Redis的特性,我們可以輕鬆實現分散式事務管理,提高系統的效能和可靠性。一、Redis簡介Redis是一種基於記憶體的資料儲存系統,具有高效的讀寫效能和豐富的數據

您在嘗試使用應用程式時是否收到“無法允許存取攝影機和麥克風”?通常,您可以在需要提供的基礎上向特定物件授予攝影機和麥克風權限。但是,如果您拒絕權限,攝影機和麥克風將無法運作,而是顯示此錯誤訊息。解決這個問題是非常基本的,你可以在一兩分鐘內完成。修復1–提供相機、麥克風權限您可以直接在設定中提供必要的攝影機和麥克風權限。步驟1–轉到“設定”選項卡。步驟2–打開「隱私與安全」面板。步驟3–在那裡打開“相機”權限。步驟4–在裡面,您將找到已要求手機相機權限的應用程式清單。步驟5–開啟指定應用的“相機”

如何實現Java中的學生成績管理功能?在現代教育系統中,學生成績管理是一項非常重要的任務。透過對學生成績的管理,學校能夠更好地監測學生的學習進度、了解他們的弱點和優勢,並根據這些資訊做出更有針對性的教學計劃。在這篇文章中,我們將討論如何使用Java程式語言來實現學生成績管理功能。首先,我們需要確定學生成績的資料結構。通常,學生成績可以被表示為一個包含學生訊息
