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 3 of 3
  1. #1
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts

    Only part of my table updates ???

    Hi,

    I am running a simple script to update one of my tables.

    But for some reason, out of the 12,000 rows it only
    processes the first 4,303 and I can not see any
    reason why it stops


    This is my simple script:

    PHP Code:
    $log_file "/home/my_path/a_log_URLs.txt"
    $handle fopen("$log_file""wb"); 
    //$today = $today-10800; 
    $logstamp date('H:i:s l, j F Y'$today);

    function 
    write_log($content) {
        global 
    $handle;
        
    fwrite($handle$content);        


    function 
    write_error($content) {
        global 
    $handle;
        
    fwrite($handle$content);     
            exit;
    }

    write_log("----------------------------------------------- \r\nNew record - Time Stamp: $logstamp \r\n");

    $sql "SELECT id FROM cb_update ORDER BY id";
    $result mysql_query($sql)    or write_error("Could not SELECT  id FROM cb_update".mysql_error()." \r\n");     

    $ctr 1;
    while(
    $row mysql_fetch_assoc($result)) {
      
    $id $row['id'];

      
    $sql_ck "SELECT prod_id FROM cb_urls WHERE prod_id = '$id'";
      
    $result_ck mysql_query($sql_ck)    or write_error("Could not SELECT  prod_id FROM cb_urls".mysql_error()." \r\n");     
      
    $num_ck mysql_num_rows($result_ck);
       if(
    $num_ck == 0) {
      
        
    $id 'new'.$ctr;
            
    $Db_url 'url_test'.$ctr;
            
    $Db_dom'   = 'dom_test'.$ctr;

        $sql_url_upt = "INSERT INTO cb_urls ( prod_id, url, dom )    VALUES ( '
    $id', '$Db_url', '$Db_dom )";
        result_url_upt = mysql_query($sql_url_upt)    or die("
    could not UPDATE cb_urls". mysql_error());
        
        write_log("
    $ctr $idUrl$Db_urlDom$Db_dom rn");
             
         }
      else {
          write_log("
    $ctr )$id Found rn");
         }
        $ctr++;     
     }    
    fclose($handle); 
    The end of my log is simply:

    4300 )GENERATORS Found
    4301 )GENETIC Found
    4302 )GENTLEMANS Found
    4303 )GENTLERAIN Found

    When I ran the script the first time it also only
    processed the first 4303 then stopped.

    It does the same on re-run.

    No errors are shown.

    ALL the other rows have valid 'id' values.

    Why does it stop ?
    What could be the problem ?

    Any ideas ?

    Thanks



    .
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #2
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    It might be in your database. Could be like a smallint restriction on the ID, or also could be a processing limit. Script seems fine?
    Rowsdower! has accused me of having mental problems, and the administrator allowed it. What a great forum huh?

  • #3
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts
    Thanks,
    I ran the script using a different order and found that it
    stopped on the same record.

    Looked at the record - no problem !

    So I deleted it

    Script ran to end after that



    .
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.


  •  

    Posting Permissions

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