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


PHP MysqliDb::orWhere方法代码示例

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


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

示例1: explode

echo '		<link rel="stylesheet" type="text/css" href="css/login_form.css">' . "\n";
echo '	</head>' . "\n";
echo '	<body>' . "\n";
if (isset($_POST['submitted'])) {
    $submited = $_POST['submitted'];
    $name = explode(" ", $_POST['name']);
    $pass = $_POST['pass'];
    if (isset($pass) && !empty($pass)) {
        if (isset($name) && !empty($name[0])) {
            if (count($name) >= 1 && count($name) <= 2) {
                if (count($name) > 1) {
                    $db->where('fName', $name[0]);
                    $db->where('lName', $name[1]);
                } else {
                    $db->where('fName', $name);
                    $db->orWhere('lName', $name);
                }
                $user = $db->getOne("Users");
                $hash = $user['password'];
                if (password_verify($pass, $hash)) {
                    echo 'Password is valid!';
                    $_SESSION['user'] = new User($user['id'], $user['fName'], $user['lName'], $user['admin']);
                } else {
                    echo 'Invalid password.';
                }
            } else {
                echo "invalid Name given";
            }
        } else {
            echo "You must enter a name";
        }
开发者ID:AlanBridgeman,项目名称:D-DTabletopWebapp,代码行数:31,代码来源:login.php

示例2:

isset($_POST['page']) ? $currentPage = $_POST['page'] : ($currentPage = 0);
$pageLimit = 50;
if ($currentPage == 0) {
    $currentPage = 1;
}
$limitFrom = $pageLimit * $currentPage - $pageLimit;
switch ($_POST['f']) {
    //search by region
    case 'fetch_users':
        //db2 is for getting total number of rows
        if (isset($_POST['search_term']) && $_POST['search_term'] != null) {
            $db->where('(username LIKE "%' . $_POST['search_term'] . '%"');
            $db->orWhere('name LIKE "%' . $_POST['search_term'] . '%"');
            $db->orWhere('lastname LIKE "%' . $_POST['search_term'] . '%")');
            $db2->where('(username LIKE "%' . $_POST['search_term'] . '%"');
            $db2->orWhere('name LIKE "%' . $_POST['search_term'] . '%"');
            $db2->orWhere('lastname LIKE "%' . $_POST['search_term'] . '%")');
        } else {
            $db->where('(username LIKE "%%"');
            $db->orWhere('name LIKE "%%"');
            $db->orWhere('lastname LIKE "%%")');
            $db2->where('(username LIKE "%%"');
            $db2->orWhere('name LIKE "%%"');
            $db2->orWhere('lastname LIKE "%%")');
        }
        if (isset($_POST['status']) && $_POST['status'] != null) {
            $db->where('status="' . $_POST['status'] . '"');
            $db2->where('status="' . $_POST['status'] . '"');
        } else {
            $db->where('status LIKE "%%"');
            $db2->where('status LIKE "%%"');
开发者ID:arshanam,项目名称:pharmacy_app,代码行数:31,代码来源:searchFunctions.inc.php

示例3:

isset($_POST['page']) ? $currentPage = $_POST['page'] : ($currentPage = 0);
$pageLimit = 50;
if ($currentPage == 0) {
    $currentPage = 1;
}
$limitFrom = $pageLimit * $currentPage - $pageLimit;
switch ($_POST['f']) {
    //search by region
    case 'fetch_products':
        //db2 is for getting total number of rows
        if (isset($_POST['search_term']) && $_POST['search_term'] != null) {
            $db->where('(item_code LIKE "%' . $_POST['search_term'] . '%"');
            $db->orWhere('barcode LIKE "%' . $_POST['search_term'] . '%"');
            $db->orWhere('description LIKE "%' . $_POST['search_term'] . '%")');
            $db2->where('(item_code LIKE "%' . $_POST['search_term'] . '%"');
            $db2->orWhere('barcode LIKE "%' . $_POST['search_term'] . '%"');
            $db2->orWhere('description LIKE "%' . $_POST['search_term'] . '%")');
        } else {
            $db->where('(item_code LIKE "%%"');
            $db->orWhere('barcode LIKE "%%"');
            $db->orWhere('description LIKE "%%")');
            $db2->where('(item_code LIKE "%%"');
            $db2->orWhere('barcode LIKE "%%"');
            $db2->orWhere('description LIKE "%%")');
        }
        if (isset($_POST['supplier']) && $_POST['supplier'] != null) {
            $db->where('supplier="' . $_POST['supplier'] . '"');
            $db2->where('supplier="' . $_POST['supplier'] . '"');
        } else {
            $db->where('supplier LIKE "%%"');
            $db2->where('supplier LIKE "%%"');
开发者ID:arshanam,项目名称:pharmacy_app,代码行数:31,代码来源:searchFunctions.inc.php


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