Automaticaly Update Sql Db!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Automaticaly Update Sql Db!

    Does any wap master know how to code automaticaly database update for evry 24 hours.. if u r not clear my point.. here is an examp
    e.. lets suppose dat every users pluses shud be updated (added) with 5 plusses i
     every 24 houres automaticaly... how to code dat... plz post here.thanx

    #2
    $now = time();
    $start=date("Y-m-d")." 23:00:00";
    $end=date("Y-m-d")." 23:01:00";



    $tstamp1=strtotime($start);
    $tstamp2=strtotime($end);
    if($now>$tstamp1 && $now<$tstamp2)
    {

    $sql = &#39;UPDATE `ibwf_users` SET `plusses` = `plusses` +5&#39;;
    mysql_query($sql);
    }



    23:00 to 23:01 - interval on each day - this interval must be more shortly in order to update only once. and you need to have at least one user online in this hour.
    http://ngeo.ro

    Comment


      #3
      thanx dude.. in which hour at least one use need indeed in da wap? and wr to put dis code?

      Comment


        #4
        thanx dude.. in which hour at least one use need indeed in da wap? and wr to put dis code?[/b]

        i dont use this site, put in the INDEX.PHP in login zone or autentification zone or main zone, dnno.
        and what is hour when at least one user..use your wap site.... dnno...
        http://ngeo.ro

        Comment


          #5
          perfect thanx again! i got wat u meant.. here is my last Q if we suppose to add 10%plusses to users only for who alredy got plusses,, how to code that?

          Comment


            #6
            i dont understand,
            you want to add plussess in procent? and you want to add plussess only for who alredy got 10%plusses? whay in procent?

            more simple is 1,2,3,4,5 plussess for each visit. who dont make visits dont have plussess.
            http://ngeo.ro

            Comment


              #7
              i meant...Ex: all the users who have more than 100 plusses.... they shud be added  20 % plusses on thier credits  ...


              ill explain it more

              lets suppose dat i hv 200 plusses
              i want to update my plusses with 20% plusses., finaly i shud hv 240, coz

              (200*120 )/100=240

              hope u understand now


              plz post here hw to code it...

              Comment


                #8
                UPDATE `ibwf_users` SET `plusses` = `plusses` +40 WHERE `plusses` < &#39;201&#39;

                this is for users who have 200 plusses and you want to add for each 40 in order to obtain 20% more.


                UPDATE `ibwf_users` SET `plusses` = `plusses` +20 WHERE `plusses` < &#39;101&#39;

                this is your first quiz , users who have 100 plusses and you want to add for each 20 in order to obtain 20%more


                the sql end the add when plusses in database is equal or more like condition WHERE


                if you want change the operator sign < into >



                is ok now?
                http://ngeo.ro

                Comment


                  #9
                  well i guess u want to add a particualr percentage to of already earned plusses to those users.. not only more than 100 or 200. Just take plusses to a variable. multiply the value from the percentage u want. Add it to the variable and thats it.

                  Comment


                    #10
                    yes pamod u rite! u got wat i meant. actualy i neead to kno da codes of add a particualr percentage to of already earned plusses to those users...

                    Comment


                      #11
                      ok araa try this..

                      <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>$now = time();
                      $start=date("Y-m-d")." 23:00:00";
                      $end=date("Y-m-d")." 23:01:00";

                      $tstamp1=strtotime($start);
                      $tstamp2=strtotime($end);
                      if($now>$tstamp1 && $now<$tstamp2)
                      {
                      $sql = &#39;UPDATE `ibwf_users` SET `plusses` = `plusses` * 1.2 WHERE `plusses` > 100&#39;;
                      mysql_query($sql);
                      }</div>

                      U can add it to index.php and at least a single user shud be there when ur server time is 23.00 Adjust time accordingly...

                      Comment


                        #12
                        thank you so much pamod and blakhowk... finally i got it.

                        Comment


                          #13
                          You are welcome bro

                          Comment


                            #14
                            hey i was trying something similar to this but couldn&#39;t get it right, im trying to update chat.php, i want to give users 1 plus for every 5 chat posts they make. but very confused with.

                            Comment


                              #15
                              to get points for 5 chat lines you must select and count the last 5 lines by user and by chatroom name.

                              like
                              SELECT COUNT(chatter) from ibwf_chat where chatter = 3 // each user have one id

                              if this result is equal with 5{

                              make the update
                              }



                              there is a problem. if the automatic refresh run two time, and user count is 5 , the update in database is double...
                              http://ngeo.ro

                              Comment

                              Working...
                              X