SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    bahrain
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up one cron job data to another

    hi
    i want to know that can i pass one cron job data to another cron job if yes how?
    i have in one cron job select query and in the other cron job having update query. how can i pass the first cron job result to the second cron job to do updation on the base of the first cron job?
    its urgent plzzz.....
    regards
    phphelp

  2. #2
    SitePoint Addict SRTech's Avatar
    Join Date
    Mar 2005
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you just run them together?

    Maybe you could post the lines creating the cron job so I could understand better?

  3. #3
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm, when you do cron job then in the first one, you do ythe query and then use javascript and then submit a form, which has values from query and then when this form is submitted then other script will automatically process it.

    i never used it and i am just thinking it should work. i might be wrong. give it a try and you got nothing to loose if it won'twork
    ---------------------------
    Errors = Improved Programming.
    My Site

  4. #4
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    bahrain
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here is the cron first query

    $query = "SELECT users.sender1, users.sender2, msg_detail.userid, msg_detail.mobile, msg_detail.groupid, msg_main.message, msg_main.type, msg_main.sender ,msg_detail.date ";
    $query .= "FROM users, msg_detail, msg_main WHERE users.userid = msg_detail.userid and msg_detail.msgid = msg_main.msgid AND (msg_detail.statusid = 6 OR msg_detail.statusid = 5) ";
    $query .= "ORDER BY msg_detail.statusid DESC, msg_detail.date LIMIT 1";
    $sql = mysql_query($query);
    $row = mysql_fetch_array($sql);


    and cron second

    $query2 = "UPDATE msg_detail SET statusid = 'p' WHERE mobile = '(SELECT msg_detail.mobile FROM users, msg_detail, msg_main WHERE users.userid = msg_detail.userid and msg_detail.msgid = msg_main.msgid limit 1)'";
    $sql2 = mysql_query($query2);


    $query3 = "UPDATE msg_detail SET statusid = '' WHERE userid = $row[2] AND mobile = $row[3] AND groupid = $row[4] AND date = $row[8] AND statusid = 'p' LIMIT 1";
    $sql3 = mysql_query($query3);
    its urgent plzzz.....
    regards
    phphelp

  5. #5
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just onemore question. why don't you put both in one script
    ---------------------------
    Errors = Improved Programming.
    My Site

  6. #6
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, two cronjobs aren't necesery in that instance; put al the queries in one script.

    Unless, however, you need them ran at difference times.

  7. #7
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    bahrain
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes i am doing it. but problem is its for sending sms and for that sms sending should not take much time i am running two cron jobs with same queries after one one minute. but problem is that at some time before the execution of update query the select query of second cron job is executed and it also takes the same mobile numbers so sms is send twice to same number. so thats why i want this thing. thisis not final if u think thier is an other way u can help me. one thing i think to lock the database until the update queries also executed but i dont know how to do it.
    its urgent plzzz.....
    regards
    phphelp

  8. #8
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi PHPhelp,

    If you can explain exactly what you are trying to do, i might be able to help.


Bookmarks

Posting Permissions

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