sql >> データベース >  >> RDS >> Mysql

MySQLでPHPを使用するDataTables:mysqlクエリを変更する方法は?

    /*
    * Filtering
     * NOTE this does not match the built-in DataTables filtering which does it
     * word by word on any field. It's possible to do here, but concerned about efficiency
     * on very large tables, and MySQL's regex functionality is very limited
     */
    
    //$sWhere = "";
    
    if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
    {
    $sWhere = "WHERE id='4' AND (";
    for ( $i=0 ; $i<count($aColumns) ; $i++ )
    {
        if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" )
        {
            $sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ";
        }
    }
    $sWhere = substr_replace( $sWhere, "", -3 );
    $sWhere .= ')';
    } else {
    $sWhere = "WHERE id = '4' ";
    }
    


    1. MySQL5.5以降のBIGINT範囲外エラー

    2. OracleDate列のクリーニング

    3. OracleのTop-Nクエリとページネーション

    4. ケースを選択するとき(選択)