Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用Doctrine\u查询更改表中的多个MySQL行?_Php_Mysql_Doctrine - Fatal编程技术网

Php 如何使用Doctrine\u查询更改表中的多个MySQL行?

Php 如何使用Doctrine\u查询更改表中的多个MySQL行?,php,mysql,doctrine,Php,Mysql,Doctrine,因此,当在我的网站的管理面板中选择一个选项时,我试图通过调用Doctrine_查询来更改MySQL数据库表中某一行中的某些特定列 详情如下: 表名:chatUsers 我需要找到所有与有 用户名:$chatUsers->username chatUsers中的列是 被叫用户名 找到所有这些行后,将所有行的列类型的值更改为user 这可能吗 到目前为止,我已经: $query = Doctrine_Query::create()->from('db_chatUsers')->where

因此,当在我的网站的管理面板中选择一个选项时,我试图通过调用Doctrine_查询来更改MySQL数据库表中某一行中的某些特定列

详情如下:

表名:chatUsers 我需要找到所有与有 用户名:$chatUsers->username chatUsers中的列是 被叫用户名 找到所有这些行后,将所有行的列类型的值更改为user 这可能吗

到目前为止,我已经:

$query = Doctrine_Query::create()->from('db_chatUsers')->where('username = $chatUsers->username')->findAll();

…我不确定从那里走到哪里,或者这是否正确。我可能得用foreach之类的词。很抱歉,我对PHP还不是很在行。

我刚从

我从未使用过教义,我不知道这是否有效

$query = Doctrine_Query::create()
    ->update('db_chatUsers')
    ->set('type', '?', 'user');
    ->where('username = '.$chatUsers->username);

// If the "user" is column not a value then use instead:
//$query->set('type', 'user');

//execute query
$rows = $query->execute();
echo $rows.' rows updated';