$bks->addBook($book); } // Check ISBN ///////////////////////////////////////////////////// if(isset($_POST['BtnCheckISBN'])){ $sqlBooks = sprintf("SELECT * FROM book WHERE isbn LIKE '%%%s%%' ORDER BY isbn", $_POST['isbn']); $rsBooks = executeSqlQuery($sqlBooks); $NoOfBooks = mysql_num_rows($rsBooks); foreach($_POST as $key=>$val){ // Store page settings so that the form will be filled $_SESSION['page_state']['book_add'][$key] = $val; } } // Check Title ///////////////////////////////////////////////////// if(isset($_POST['BtnCheckTitle'])){ $sqlBooks = sprintf("SELECT * FROM book WHERE %s ORDER BY title", BuildSearchCriteriaString($_POST['title'],"title","AND")); $rsBooks = executeSqlQuery($sqlBooks); $NoOfBooks = mysql_num_rows($rsBooks); foreach($_POST as $key=>$val){ // Store page settings so that the form will be filled $_SESSION['page_state']['book_add'][$key] = $val; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>ULMS: Add New Book</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="css/styles.css" rel="stylesheet" type="text/css"> <script language="JavaScript" src="js/gen_validatorv2.js" type="text/javascript"></script> </head>
$SearchISBN = $_REQUEST['SearchISBN']; $LimitN = $_REQUEST['LimitN']; // Number of records per page $LimitI = $_REQUEST['LimitI']; // Number of records per page /// Retrieve a recordset from the database ////////////////////////////// // Build the WHERE clause $WhereClause = "WHERE 1=1 AND"; // '1=1 AND' is for situations when there's no value in any field if($SearchTitle != ""){ $WhereClause = $WhereClause . BuildSearchCriteriaString($SearchTitle,"title","AND") . " AND"; } if($SearchAuthors != ""){ $WhereClause = $WhereClause . BuildSearchCriteriaString($SearchAuthors,"authors","AND") . " AND"; } if($SearchSubjects != ""){ $WhereClause = $WhereClause . BuildSearchCriteriaString($SearchSubjects,"subjects","AND") . " AND"; } if($SearchISBN != ""){ $WhereClause = $WhereClause . " isbn LIKE '%" . $SearchISBN . "%' AND"; } // remove the last AND $WhereClause = substr($WhereClause,0,strlen($WhereClause)-3); // Calculate $TotalRecords if (!isset($_REQUEST['TotalRecords'])){ $sqlTotal = sprintf("SELECT COUNT(bid) FROM book %s", $WhereClause); $recordsetTotal = executeSqlQuery($sqlTotal); $rowTotal = mysql_fetch_array($recordsetTotal); $TotalRecords = $rowTotal[0]; } else {