English 中文(简体)
编集查询的编码
原标题:Codeigniter compiling a query

Hi Codeigniter 专家。

我用几条电话汇编了请求书。

在完成这项工作时,我利用请求检索一些当然数据。

Each call, calls another function which gets and returns some translations which is supposed to be used in the QUERY

但是,似乎同样,译本的WHERE条件被Im在主要请求中汇编的WHERE条件所混为一谈。

private function add_to_asq($field_name, $values)
{
.
.
.
.
    $result = array();
    foreach( $values[$last_level] as $val )
    {
           foreach( $val as $v  )
           {
          $result[] = $this->db->escape( $this->asq_value_translate( $last_level, $v, $field_name ) );
        }
    }

    $this->db->where_in( sprintf(  %1$s  , $field_name  ) , implode(  ,  , $result ) );

}


    private function asq_value_translate( $level, $value_md5 , $field_name )
    {   
        $this->db->select( sprintf(  level_%1$d, level_%1$d_value  , $level ) )
        ->distinct()
        ->from( search_options_tree_view )
        ->where( sprintf(  md5( level_%1$d_value ) =   , $level ), $value_md5 )
        ->where(  field_name  , $field_name );
        $q = $this->db->get();
        $value_name = sprintf(  level_%1$d  , $level );
        $row = $q->row(0);
        $q->free_result();
        return $row->$value_name;       
    }

and the DB complains about it

序号:1054

条款中未指明的列类

SELECT DISTINCT `level_1`, `level_1_value` FROM (`search_options_tree_view`) WHERE 

`type` IN (  Forhandler  )

 AND md5( level_1_value ) =  138be735c55896dbdbea9b6c5d503b6f  AND `field_name` =  fuel 

档案名称:C:wampwwwsystemdatabaseDB_driver.php

Line Number: 330

As you see the type IN ( Forhandler ) has not anything to with the asq_value_translation.

你们是否有建议?

我对克隆技术的思考,但我当时认为,我先问,然后开枪。

感谢很多时间,时间很短。

问题回答

您应使用<代码>$this->db->last_query(,以了解你询问的结果。 然后,请你回答问题,并把它交给你的客户,以确保问题不是在密码上,而是在你看来。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签