-1

以下代码有什么问题,因为我的数据丢失,并且有返回记录:

     $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);
    }

编辑:我正在创建一个 Web 服务来从 mysql 数据库中获取一些数据。我用休息客户端测试我的服务。(我不需要回声!!!)

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 回答