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 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    loop through file list

    I am attempting to generate a list of SQL commands that i will later insert. The only part at this time I seem to be stuck on is looping the file name. I need my scandir to loop through the nofilter directory and change $image each time a new line or sql query is given. I have the code and output below. Essentially no sql query should have the same $image being echo'd into it

    PHP Code:
    for ($i=1351314000$i<=1351400400$i+= 14400)
      {
      

    $images scandir("/home/fb/public_html/post/uploads/nofilter/");
    foreach(
    $images as $image)
    {
    }

      
    //copy file over from no filter
    $orig "/home/fb/public_html/post/uploads/nofilter/".$image."";
    $dest =   "/home/fb/public_html/post/uploads/".$image."";
    //copy($orig, $dest);


    //output
      
    echo "The number is " $i "<br />";
    echo 
    $image;
    echo 
    "<br>";
    echo 
    "<br>";
    echo 
    "<br>";

    echo 
    "

    INSERT INTO `fb_fb`.`postcron_schedule` (
    `id` ,
    `status_message` ,
    `link` ,
    `photo_url` ,
    `status_name` ,
    `status_caption` ,
    `status_description` ,
    `uid` ,
    `page_id` ,
    `access_token` ,
    `post_to` ,
    `status_type` ,
    `schedule_type` ,
    `is_process` ,
    `process_time` ,
    `process_at` ,
    `display_time` ,
    `created_by`
    )
    VALUES (
    NULL , '', '', '/home/fb/public_html/post/includes/../uploads/"
    $image ."', NULL , NULL , NULL , '0', '135031429962113', 'AAAGLZAMh7YSUBALRMCW60Rdol1kD80ZBNymqkgyQfBXDour2KsvVWKFcnZB9cU9OSLRMQjnEuKHZCTNoTZC4jf9GFtMU11BTD8JZAUFl0EVgZDZD', 'page', 'photo', 'schedule', '0', '"$i ."', NULL , '"$i ."', '100000103637895'
    );
    "
    ;

    echo 
    "<br>";
    echo 
    "<br>";
      
     } 
    OUTPUT

    The number is 1351314000
    8120925654_4041b7c50f_o.jpg


    INSERT INTO `fb_fb`.`postcron_schedule` ( `id` , `status_message` , `link` , `photo_url` , `status_name` , `status_caption` , `status_description` , `uid` , `page_id` , `access_token` , `post_to` , `status_type` , `schedule_type` , `is_process` , `process_time` , `process_at` , `display_time` , `created_by` ) VALUES ( NULL , '', '', '/home/fb/public_html/post/includes/../uploads/8120925654_4041b7c50f_o.jpg', NULL , NULL , NULL , '0', '135031429962113', 'AAAGLZAMh7YSUBALRMCW60Rdol1kD80ZBNymqkgyQfBXDour2KsvVWKFcnZB9cU9OSLRMQjnEuKHZCTNoTZC4jf9GFtMU11BTD8 JZAUFl0EVgZDZD', 'page', 'photo', 'schedule', '0', '1351314000', NULL , '1351314000', '100000103637895' );

    The number is 1351328400
    8120925654_4041b7c50f_o.jpg


    INSERT INTO `fb_fb`.`postcron_schedule` ( `id` , `status_message` , `link` , `photo_url` , `status_name` , `status_caption` , `status_description` , `uid` , `page_id` , `access_token` , `post_to` , `status_type` , `schedule_type` , `is_process` , `process_time` , `process_at` , `display_time` , `created_by` ) VALUES ( NULL , '', '', '/home/fb/public_html/post/includes/../uploads/8120925654_4041b7c50f_o.jpg', NULL , NULL , NULL , '0', '135031429962113', 'AAAGLZAMh7YSUBALRMCW60Rdol1kD80ZBNymqkgyQfBXDour2KsvVWKFcnZB9cU9OSLRMQjnEuKHZCTNoTZC4jf9GFtMU11BTD8 JZAUFl0EVgZDZD', 'page', 'photo', 'schedule', '0', '1351328400', NULL , '1351328400', '100000103637895' );

    The number is 1351342800
    8120925654_4041b7c50f_o.jpg


    INSERT INTO `fb_fb`.`postcron_schedule` ( `id` , `status_message` , `link` , `photo_url` , `status_name` , `status_caption` , `status_description` , `uid` , `page_id` , `access_token` , `post_to` , `status_type` , `schedule_type` , `is_process` , `process_time` , `process_at` , `display_time` , `created_by` ) VALUES ( NULL , '', '', '/home/fb/public_html/post/includes/../uploads/8120925654_4041b7c50f_o.jpg', NULL , NULL , NULL , '0', '135031429962113', 'AAAGLZAMh7YSUBALRMCW60Rdol1kD80ZBNymqkgyQfBXDour2KsvVWKFcnZB9cU9OSLRMQjnEuKHZCTNoTZC4jf9GFtMU11BTD8 JZAUFl0EVgZDZD', 'page', 'photo', 'schedule', '0', '1351342800', NULL , '1351342800', '100000103637895' );

    The number is 1351357200
    8120925654_4041b7c50f_o.jpg


    INSERT INTO `fb_fb`.`postcron_schedule` ( `id` , `status_message` , `link` , `photo_url` , `status_name` , `status_caption` , `status_description` , `uid` , `page_id` , `access_token` , `post_to` , `status_type` , `schedule_type` , `is_process` , `process_time` , `process_at` , `display_time` , `created_by` ) VALUES ( NULL , '', '', '/home/fb/public_html/post/includes/../uploads/8120925654_4041b7c50f_o.jpg', NULL , NULL , NULL , '0', '135031429962113', 'AAAGLZAMh7YSUBALRMCW60Rdol1kD80ZBNymqkgyQfBXDour2KsvVWKFcnZB9cU9OSLRMQjnEuKHZCTNoTZC4jf9GFtMU11BTD8 JZAUFl0EVgZDZD', 'page', 'photo', 'schedule', '0', '1351357200', NULL , '1351357200', '100000103637895' );

    The number is 1351371600
    8120925654_4041b7c50f_o.jpg


    INSERT INTO `fb_fb`.`postcron_schedule` ( `id` , `status_message` , `link` , `photo_url` , `status_name` , `status_caption` , `status_description` , `uid` , `page_id` , `access_token` , `post_to` , `status_type` , `schedule_type` , `is_process` , `process_time` , `process_at` , `display_time` , `created_by` ) VALUES ( NULL , '', '', '/home/fb/public_html/post/includes/../uploads/8120925654_4041b7c50f_o.jpg', NULL , NULL , NULL , '0', '135031429962113', 'AAAGLZAMh7YSUBALRMCW60Rdol1kD80ZBNymqkgyQfBXDour2KsvVWKFcnZB9cU9OSLRMQjnEuKHZCTNoTZC4jf9GFtMU11BTD8 JZAUFl0EVgZDZD', 'page', 'photo', 'schedule', '0', '1351371600', NULL , '1351371600', '100000103637895' );

    The number is 1351386000
    8120925654_4041b7c50f_o.jpg


    INSERT INTO `fb_fb`.`postcron_schedule` ( `id` , `status_message` , `link` , `photo_url` , `status_name` , `status_caption` , `status_description` , `uid` , `page_id` , `access_token` , `post_to` , `status_type` , `schedule_type` , `is_process` , `process_time` , `process_at` , `display_time` , `created_by` ) VALUES ( NULL , '', '', '/home/fb/public_html/post/includes/../uploads/8120925654_4041b7c50f_o.jpg', NULL , NULL , NULL , '0', '135031429962113', 'AAAGLZAMh7YSUBALRMCW60Rdol1kD80ZBNymqkgyQfBXDour2KsvVWKFcnZB9cU9OSLRMQjnEuKHZCTNoTZC4jf9GFtMU11BTD8 JZAUFl0EVgZDZD', 'page', 'photo', 'schedule', '0', '1351386000', NULL , '1351386000', '100000103637895' );

    The number is 1351400400
    8120925654_4041b7c50f_o.jpg


    INSERT INTO `fb_fb`.`postcron_schedule` ( `id` , `status_message` , `link` , `photo_url` , `status_name` , `status_caption` , `status_description` , `uid` , `page_id` , `access_token` , `post_to` , `status_type` , `schedule_type` , `is_process` , `process_time` , `process_at` , `display_time` , `created_by` ) VALUES ( NULL , '', '', '/home/fb/public_html/post/includes/../uploads/8120925654_4041b7c50f_o.jpg', NULL , NULL , NULL , '0', '135031429962113', 'AAAGLZAMh7YSUBALRMCW60Rdol1kD80ZBNymqkgyQfBXDour2KsvVWKFcnZB9cU9OSLRMQjnEuKHZCTNoTZC4jf9GFtMU11BTD8 JZAUFl0EVgZDZD', 'page', 'photo', 'schedule', '0', '1351400400', NULL , '1351400400', '100000103637895' );

  • #2
    New Coder
    Join Date
    Jan 2011
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Resolved

    PHP Code:
    $time time();
    $images scandir("/home/fb/public_html/post/uploads/nofilter/");
    foreach(
    $images as $image) {
        if (
    $image == '.' || $image == '..') {
            continue;
        }

        
    $time += 14400//add 4 hours every interval

        //copy file over from no filter
        
    $orig "/home/fb/public_html/post/uploads/nofilter/".$image."";
        
    $dest =   "/home/fb/public_html/post/uploads/".$image."";
        
    //copy($orig, $dest);


        //output
          
    echo "The number is " $time "<br />";
        echo 
    $image;
        echo 
    "<br>";
        echo 
    "<br>";
        echo 
    "<br>";

        echo 
    "

        INSERT INTO `fb_fb`.`postcron_schedule` (
        `id` ,
        `status_message` ,
        `link` ,
        `photo_url` ,
        `status_name` ,
        `status_caption` ,
        `status_description` ,
        `uid` ,
        `page_id` ,
        `access_token` ,
        `post_to` ,
        `status_type` ,
        `schedule_type` ,
        `is_process` ,
        `process_time` ,
        `process_at` ,
        `display_time` ,
        `created_by`
        )
        VALUES (
        NULL , '', '', '/home/fb/public_html/post/includes/../uploads/"
    $image ."', NULL , NULL , NULL , '0', '135031429962113', 'AAAGLZAMh7YSUBALRMCW60Rdol1kD80ZBNymqkgyQfBXDour2KsvVWKFcnZB9cU9OSLRMQjnEuKHZCTNoTZC4jf9GFtMU11BTD8JZAUFl0EVgZDZD', 'page', 'photo', 'schedule', '0', '"$time ."', NULL , '"$time ."', '100000103637895'
        );
        "
    ;

        echo 
    "<br>";
        echo 
    "<br>";

     } 


  •  

    Posting Permissions

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