hisham
IS-IT--Management
- Nov 6, 2000
- 194
I have the following table:
Id priority
1 3
2 5
3 7
4 2
5 1
6 6
7 4
$pr = 3;
$query = mysql_query("select * from mytable ORDER BY priority"
;
$num = mysql_num_rows($query);
for ($i=1;$i<$num+1;$i++){
if ($i>=$pr){
$j = $i + 1;
$SQL="UPDATE mytable SET priority ='$j' where priority = '$i'";
am trying to update the table by adding 1 to the selected rows then 3 will be 4 and 4 will be 5 etc…, but it won't work.
Thanks in advance
Id priority
1 3
2 5
3 7
4 2
5 1
6 6
7 4
$pr = 3;
$query = mysql_query("select * from mytable ORDER BY priority"
$num = mysql_num_rows($query);
for ($i=1;$i<$num+1;$i++){
if ($i>=$pr){
$j = $i + 1;
$SQL="UPDATE mytable SET priority ='$j' where priority = '$i'";
am trying to update the table by adding 1 to the selected rows then 3 will be 4 and 4 will be 5 etc…, but it won't work.
Thanks in advance