Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder darksecu's Avatar
    Join Date
    Dec 2011
    Thanked 1 Time in 1 Post

    Problem In Updating

    Table name "cycles" This is how my table looks

    I want to fetch the top user where line=1,2,3,4 so on , done by looping ..
    then i want to update those users with line="line number +1" and percent column being updated by +10 ...

    here the code i am trying ... working great but its not calculating the new line number properly..
    it should update 1 to 2 , 2 to 3 , 5 to 6 and so on but its updating database line column with "1+1 , 2+1 , 5+1 and so on" text ..

    PHP Code:
    $exist=mysql_num_rows(mysql_query("select * from cycles where line='$i'"));
    if (
    $exist == '0') { $i++; } else {
    $row=mysql_fetch_assoc(mysql_query("select * from cycles where deleted='0' and line='$i' order by id limit 0,1")); 
    mysql_query("update cycles set line='$lines+1' where id=$id");
    $i++; }

    i think there is some problem in adding code ... please help me to fix it ..
    Last edited by darksecu; 04-12-2012 at 04:16 PM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts