当前位置: 首页>>代码示例>>PHP>>正文


PHP search::get方法代码示例

本文整理汇总了PHP中search::get方法的典型用法代码示例。如果您正苦于以下问题:PHP search::get方法的具体用法?PHP search::get怎么用?PHP search::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在search的用法示例。


在下文中一共展示了search::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: insert

 function insert($name, $parent, $comment)
 {
     //debug
     //echo "$name - $parent - $comment<br>";
     $owner = user::id();
     // user id
     $status = 2;
     // descriptor
     $linktype = 1;
     // hyrarchic link
     $parentArray = search::get($parent, "exact");
     $entryArray = search::get($name, "exact");
     $parentId = $parentArray[0][ID];
     $entryId = $entryArray[0][ID];
     // entry already exists - create polyseme
     if ($entryId) {
         $name = "{$name} ({$parent})";
     }
     // create new entry
     $entryString = "INSERT INTO entry SET\r\n      name='{$name}',\r\n      owner='{$owner}',\r\n      status='{$status}',\r\n      comment='{$comment}'";
     mysql_query($entryString);
     // get new id
     $newId = mysql_insert_id();
     //debug
     //echo "$parent ($parentId) > $name ($newId)<br>";
     // create link to parent
     if ($newId) {
         $linkString = "INSERT INTO parent SET\r\n        parent='{$parentId}',\r\n        child='{$newId}',\r\n        type='{$linktype}'";
         mysql_query($linkString);
     }
     return $name;
 }
开发者ID:nibble-arts,项目名称:openthesaurus,代码行数:32,代码来源:libimport.php

示例2: unset

            }
            form::update_entry($_GET, $errorArray);
            echo "</div>";
        }
        //------------------------------------------------------------------------------
        // display hyrarchy list
        if (session::get("hyrarchy")) {
            echo "<div id='hyrarchy'>";
            $display->header();
            $display->display(0, -1, 0, $errorArray);
            //thesaurus-resource, parent, depth, position
            echo "</div>";
        }
        //------------------------------------------------------------------------------
        // search field
        $searchResult = search::get(session::get(search));
        // display search result
        if (!session::get(searchshow)) {
            unset($searchResult);
        }
        // clear serach string if nothing new
        if (count($searchResult) > 0 and session::get(searchshow)) {
            // display search window
            search::display($searchResult);
        }
        // display search formular
        search::form(session::get(search));
    } else {
        form::standard();
    }
}
开发者ID:nibble-arts,项目名称:openthesaurus,代码行数:31,代码来源:index.php

示例3: insert

 function insert($_arg, $mandatory)
 {
     $errorArray = array();
     if ($_arg[action] == "insert" or $_arg[action] == "update") {
         session::destroy(searchshow);
         $action = $_arg[action];
         $ok = TRUE;
         // set error default ok
         //-----------------------------------------------------------------------------
         // insert
         if ($_arg[action] == "insert") {
             //-----------------------------------------------------------------------------
             // check for existing name entry
             $tempArray = search::get("{$_arg['name']}", "exact");
             if (is_array($tempArray)) {
                 $ok = FALSE;
                 $errorArray[name] = "exist";
             } else {
                 // check for alike name entry
                 $tempArray = search::get("{$_arg['name']}%", "start");
                 if (is_array($tempArray)) {
                     //            $ok = FALSE;
                     $errorArray[name] = "alike";
                 }
             }
         }
         // check mandatory fields
         foreach ($mandatory as $check) {
             if (!$_arg[$check] != "") {
                 $ok = FALSE;
                 $errorArray[$check] = "error";
             }
         }
         //echoalert($errorArray);
         // mandatory fields ok -> create sql-string out of data
         if ($ok) {
             //echoalert($_GET);
             //-----------------------------------------------------------------------------
             // reset parameters for next entry
             unset($_GET[name]);
             // delete name, sysnonym and comment
             unset($_GET[comment]);
             unset($_arg[action]);
             // remove action comment from $_arg
             $errorArray = false;
             // combine parameters
             $queryArray = array();
             while ($entry = each($_arg)) {
                 switch ($entry[key]) {
                     case parent:
                         $parent = $entry[value];
                         // filter parent
                         break;
                     case id:
                         $child = $entry[value];
                         // filter ID
                         break;
                     case type:
                         $type = $entry[value];
                         // filter type
                         break;
                     case PHPSESSID:
                         // filter SSID
                         break;
                     case orderdefault:
                         system::setval("val_orderdefault", $entry[value]);
                         break;
                     default:
                         array_push($queryArray, $entry[key] . "='" . $entry[value] . "'");
                         break;
                 }
             }
             $insertString = implode(",", $queryArray);
             // add sql-clauses
             switch ($action) {
                 // query for entry insert
                 case insert:
                     $_GET[action] = "add";
                     // set for next entry
                     $insertString .= ",owner='" . user::id() . "'";
                     $queryString = "INSERT INTO entry SET {$insertString}";
                     // = "INSERT entry
                     //echoalert($queryString);
                     if (database::query($queryString)) {
                         // query for parent insert
                         $child = mysql_insert_id();
                         $parentString = "INSERT INTO parent SET child='{$child}',parent='{$parent}',type='{$type}',owner='{$user}'";
                         database::query($parentString);
                     }
                     break;
                     // query for entry update
                 // query for entry update
                 case update:
                     $queryString = "UPDATE entry SET {$insertString} WHERE ID='" . $_arg[id] . "';";
                     // = "UPDATE entry
                     database::query($queryString);
                     break;
             }
         }
         return $errorArray;
//.........这里部分代码省略.........
开发者ID:nibble-arts,项目名称:openthesaurus,代码行数:101,代码来源:database.php


注:本文中的search::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。