Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jun 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Regarding scheduling jobs in php

    Hi Everyone,

    I have an issue regarding the scheduling of jobs in php.
    My requirement is i have add_details table in my phpmyadmin database . In that table i have both buyers and sellers who would post their advertisements for every category (like computers , electronics etc) .
    When a buyer posts his add for a certain category in the website then i want to run a job in php at night 12:00 o'clock for getting the data of sellers for that category .
    So how to run a job in php and get the data from the table present in
    phpmyadmin database ? .
    How to write the code for scheduling this job in php .?
    And should i host the site in internet for scheduling job in php? can i schedule a job in php from my local system .

    Please help me .. awaiting for your response .

    Thank u very in advance.

  • #2
    New Coder
    Join Date
    Jun 2010
    Posts
    24
    Thanks
    2
    Thanked 1 Time in 1 Post
    You can do this in 2 ways.

    1) By using cron job setting in control panel for the script (PHP Script) to run for getting for getting the data of sellers for that category.

    2) By setting the task in your PC (scheduled tasks - but I dont think this works)

  • #3
    New Coder
    Join Date
    Jun 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Clarification On Control panel

    Hi Shanu ,

    U said it can be done by cron job setting in control panel of the script.
    I didn't get where will be the control panel for the script.i am using xammp as the webserver in my local machine .
    Can u please explain where would be the control panel present..?

    And i heard that cron job is for unix operating system , can we run the job it in windows also ...

    Thanx ,
    Rajesh.

  • #4
    New Coder
    Join Date
    Jun 2010
    Posts
    24
    Thanks
    2
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Rajesh77 View Post
    Hi Shanu ,

    U said it can be done by cron job setting in control panel of the script.
    I didn't get where will be the control panel for the script.i am using xammp as the webserver in my local machine .
    Can u please explain where would be the control panel present..?

    And i heard that cron job is for unix operating system , can we run the job it in windows also ...

    Thanx ,
    Rajesh.
    Its not control panel of the script, I said to set the cron job for the script.

    I hope your site is live or it will be live sometime?? It is web based application right?

    You can set the cron job once your site is live.

  • #5
    New Coder
    Join Date
    Jun 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes its web application ..
    It is not live now.. Can't i schedule the job when its is not online ..
    Can u tell me how to right the code for scheduling the php script..

    Thanx,
    Rajesh.

  • #6
    New Coder
    Join Date
    Jun 2010
    Posts
    24
    Thanks
    2
    Thanked 1 Time in 1 Post
    Yes, You cannot schedule the job when it is not online using cron job. CRON JOB is set in the control panel by giving the path to the script you write as per your requirements.

    Suppose, you want to get the data of sellers for that category "a"

    You will create a php file as usual with the script in it

    PHP Code:
    $query mysql_query ("Select sellers from table_sellers where category_name ='a'");
    $res mysql_fetch_array($query);
    // you wil get the results here 
    $sellers $res["sellers"]; 
    and this $ sellers variable is the output of your script, store it as per your requirement, say write into a txt file from where you can see the data for sellers daily.

    If you want to run the job before making it live just create the php file and then use the windows scheduler to run the script on your local pc

    Hope this helps.


  •  

    Posting Permissions

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