當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DataBase::disconnect方法代碼示例

本文整理匯總了PHP中DataBase::disconnect方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataBase::disconnect方法的具體用法?PHP DataBase::disconnect怎麽用?PHP DataBase::disconnect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DataBase的用法示例。


在下文中一共展示了DataBase::disconnect方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: intval

 $sSqlOffset = intval($_POST['sql_offset'], 10);
 // get new db object
 // (the parameters are stored in the db_config.php file)
 $oDB = new DataBase($sHost, $sDbUser, $sDbPasswd, $sDatabase);
 $oDB->connect();
 // escape the search term
 $sSearchTerm = mysql_real_escape_string($_POST['search_term']);
 // extend the search term
 $sSearchTerm = '%' . $sSearchTerm . '%';
 // escape the db field names of the both languages
 $sDbLang1 = mysql_real_escape_string($_POST['db_lang_1']);
 $sDbLang2 = mysql_real_escape_string($_POST['db_lang_2']);
 // now build the query
 $sQuery = sprintf("SELECT %s, %s FROM voka WHERE %s LIKE '%s' OR %s LIKE '%s' LIMIT %d, %d", $sDbLang1, $sDbLang2, $sDbLang1, $sSearchTerm, $sDbLang2, $sSearchTerm, $sSqlOffset, $sSqlLimit);
 $oResult = $oDB->query($sQuery);
 $oDB->disconnect();
 if (!$oResult) {
     //echo "DB error: " . $oDB->getLastError();
     $aReturnCode = array("code" => -1);
     echo json_encode($aReturnCode);
     return;
 }
 if (mysql_num_rows($oResult) == 0) {
     //echo "No result: ". $oDB->getLastError();
     $aReturnCode = array("code" => 0);
     echo json_encode($aReturnCode);
     return;
 }
 // determine total number of possible results
 $oDB->connect();
 $sQueryTotalNum = sprintf("SELECT COUNT(*) AS total_num FROM voka WHERE %s LIKE '%s' OR %s LIKE '%s'", $sDbLang1, $sSearchTerm, $sDbLang2, $sSearchTerm);
開發者ID:rafomundo,項目名稱:pure,代碼行數:31,代碼來源:db_query.php

示例2: array

                 $folder = "images/" . $_POST['course_id'] . "/";
                 $fields = array('img_id', 'img_loc', 'img_des', 'doc_id');
                 //here we write the attribute or fields which is in the table insid the database
                 $values = array('', $folder . $_FILES['upload']['name'][$i], 'test', $get_decument_id);
                 //put all  variables in values  array()
                 $con->insert($fields, $values, 'doc_imgs');
                 //call insert(all fields or attribute , value array,table name)
             }
             //end of if statament if(move_uploaded_file($tmpFilePath, $newFilePath))
         }
         //end of if ($tmpFilePath != "")
     }
     //end of for loop
     $sql = "SELECT img_loc FROM doc_imgs where doc_imgs.doc_id='" . $get_decument_id . "' ";
     $data = mysql_query($sql);
     $con->disconnect();
 }
 //end of if statment  if(isset($_POST['pleace']))
 if (isset($_POST['change'])) {
     $sql = "SELECT c_id FROM documentation where c_num='" . $course_id . "' ";
     echo $sql;
     $result = mysql_query($sql);
     while ($row = mysql_fetch_array($result)) {
         $get_decument_id = $row['c_id'];
         echo $get_decument_id;
     }
     $con->update('documentation', array('course' => $course, 'event' => $event, 'c_name' => $course_name, 'c_num' => $course_id, 'c_location' => $pleace, 'c_collage_index' => $collage, 'c_dept' => $dept, 'c_price' => $price, 'c_gender' => $type, 'c_target_group' => $target, 'c_duration' => $how_long, 'c_req_num' => $at_least, 'c_reg_time' => $start_date, 'c_max_num' => $at_most, 'c_time_from' => $start_time, 'c_time_to' => $end_time, 'c_major' => $course_about, 'c_languate' => $language, 'c_goals' => $goals, 'c_doc_desc' => $description, 'c_notes' => $notes), array('c_id', $get_decument_id));
 }
 if (isset($_POST['delete_course_id'])) {
     //echo "it is set <br/>";
     $course_id = $_POST['delete_course_id'];
開發者ID:osama9976,項目名稱:git-learning,代碼行數:31,代碼來源:database_jobs.php


注:本文中的DataBase::disconnect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。