-1

What is wrong with the following code, because my data is missing, and there are returned records :

     $db_stmt = new PDOStatement();
    $db_stmt = $this->db->prepare("SELECT id_translation AS ID, content AS Label FROM ?");        
    $language = "language_translation_" . $request->request_object->language; 
    $db_stmt->bindParam(1, $language);        
    $db_stmt->execute();        
    while ($obj = $db_stmt->fetchObject()){
        $response->response_list[] = $obj;
        unset($obj);
    }

Edit : I am creating a web service to get some data from a mysql database. I test my service with a rest client. (I don't need to echo !!!)

4

1 に答える 1

1

パラメータをテーブル名にバインドできないと思います。のようなものを試してください

$db_stmt = $this->db->prepare("SELECT id_translation AS ID, content AS Label FROM `$language`");

お役に立てれば。

于 2012-07-02T14:21:07.690 に答える