0 Replies Latest reply on Jan 16, 2013 11:43 AM by newcf

    Scheduled Tasks In Database

    newcf Level 1

      not sure how to do it, but pls advice.
      I have the schedule task to pass diffrent ID nto url for the same page.  If I have 3 IDs, I don't want to create 3 pages from CF admin schedule like
      task.cfm?id=1
      task.cfm?id=2
      task.cfm?id=3

      Instead of doing that, i create 2 pages below
      Thanks

       

      <!---run.cfm--->
      got 3 ID returned from variables.q_compInfo query(ID =1, 2 and 3).  I want to loop thru then pass id into task.cfm dynamiclly but runs it for 3 time.
      <cfset baseUrl = ("http://" &cgi.server_name &getDirectoryFromPath( cgi.script_name )) />

      <cfoutput>
      <cfloop query="variables.q_compInfo">

      <cfhttp method="get" url="#baseUrl#task.cfm" timeout="1" throwonerror="false">

      <!--- Pass the task ID through to the RUN page. --->
      <cfhttpparam type="url" name="id" value="#task.ID#"/>

      </cfhttp>

      </cfloop>

      </cfoutput>

      <!---task.cfm--->
      when run.cfm excuted, I expected it query will be run 3 time and update this table for 3 dirrent ID.
      <cfquery name="update" datasource="#variables.dsn#">
      update  tbl
      set schedule = 3
      where id = #url.id#
      </cfquery>