Jump to content

[SOLVED] UPDATE and SELECT at the same time - or at least return affected ids.


MadnessRed

Recommended Posts

I would like to update a table and read from it in 1 go if that is possible, something like

 

$qry = mysql_query("UPDATE AND SELECT FROM `table` SET `group` = 0 WHERE `group` = '$group' ;");
$affected_members = array();
while($row = mysql_fetch_assoc($qry)){ $affected_members[] = $row['id'] ; }

 

or

 

mysql_query("UPDATE  `table` SET `group` = 0 WHERE `group` = '$group' ;");
$affacted_members = mysql_affected_ids();

 

Is there a way to do this, or will I need 2 queries?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.