If you knew my foot you would understand why I want to shoot it.
Well I ended up using
Code: Select all
if($_POST['doApprove'] == 'Done') {
mysql_query("update users set next='1' where id > '$id' LIMIT 1");
mysql_query("update users set next='0' where id='$id'");
$to_email = "select user_email from users where id > '$id' LIMIT 1";
list($highest) = mysql_fetch_row(mysql_query("select id from users where id >'$id'"));
if(empty($highest)) {
mysql_query("update users set next='1' where id > 0 LIMIT 1");
mysql_query("update users set next='0' where id='$id'");
mysql_query("select user_email from users where id > 0 LIMIT 1");
and it works.
Now I am just trying to restrict the updates to rows that share a common var in another field called "group". So if I have:
id | next | group
______________
1 | 0 | alpha
2 | 0 | alpha
3 | 0 | alpha
4 | 1 | alpha
5 | 0 | beta
6 | 0 | beta
I want to make sure that when user id 4 submits the form, it will look like this:
id | next | group
______________
1 | 1 | alpha
2 | 0 | alpha
3 | 0 | alpha
4 | 0 | alpha
5 | 0 | beta
6 | 0 | beta
and NOT like this:
id | next | group
______________
1 | 0 | alpha
2 | 0 | alpha
3 | 0 | alpha
4 | 0 | alpha
5 | 1 | beta
6 | 0 | beta
...because the logged-in user id 4 is in the alpha group. (He's wicked smaht).
It seems so simple... I guess I'm too tired. There's a hidden get part of the form too, like this:
Code: Select all
if ($get['doSearch'] == 'List') {
if($get['qoption'] == 'incoming') {
$cond = "where `id`='$_SESSION[user_id]'";
}
if($get['qoption'] == 'incoming') {
$sql = "select * from users $cond";
}
Should I specify the "group" restriction there, or in the POST part above?