Vẽ một hộp xung quanh các yếu tố có để chỉ ra các mục liên quan. HTML Wrox Ultimate HTML Cơ sở dữ liệu liệt kê Nhúng tài liệu của bất cứ loại nào trong trang, để được xem trong một ứng dụng khác phù hợp Làm cho văn bản như nhấn mạnh, thường là in nghiêng. | q expdata . NOT LIKE nmr AND q expdata . NOT LIKE theor OR q expdata . NULL else q expdata mkLikeOpt expdata else q expdata This is where things can get hairy. To create a correctly formed query statement we need to check the existence of the previous clauses generated from each variable. To make the code more compact I chose to use the ternary conditional operator condition option1 option2 which we saw in Chapter 6. construct and submit the search query SELECT DISTINCT id id ligands query . FROM protein site WHERE check the existence of each part of the query before sending qtemp q metal q metal qtemp . qtemp q num lig AND . q num lig q num lig qtemp . qtemp q expdata AND . q expdata q expdata qtemp . qtemp q r val AND . q r val q r val qtemp . qtemp q res AND . q res q res qtemp . qtemp q author AND . q author q author query . qtemp query . AND id id ORDER BY id query strtolower stripslashes query If we are debugging the script . if debug is set to true let s save some data that can later be readily parsed save to a file for debugging if debug datestamp date Y-m-d H m s time dbgfp fopen querylog a ip getenv REMOTE ADDR agent getenv HTTP USER AGENT fwrite dbgfp datestamp fwrite dbgfp ip agent fwrite dbgfp query The code for performing the query and processing the results is similar to that for the script above Get the results and process php errormsg @ result SQL query query link msqlerrormsg SQL error if php errormsg echo HTML BODY BGCOLOR white B echo PHP Error echo php errormsg . P if msqlerrormsg echo mSQL Error . msqlerrormsg echo B BODY HTML fwrite dbgfp ERROR IN QUERY PHP . php errormsg . mSQL . msqlerrormsg . n fclose dbgfp exit @ nrows SQL_num_rows result Next we generate a listing of the variables defined by the user. This is usually a good way of providing feedback and also .