SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru godsfshrmn's Avatar
    Join Date
    Mar 2001
    Posts
    671
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Image update script not working as intended

    I have a CRON job to run this PHP script to update each user's image every night. For some reason, it is only going to img 334. It should be going up to 417.

    The code is below and here is a breif description.

    First the highest ID number is grabbed from the database. (I think the problem may be here).
    Then a for loop is used, going 1 to the ID number found.
    Next, the ID is checked to see if it is actually in the DB using mysql_num_rows. Records can be deleted from the DB, so there will not be an even number span going on.
    The rest of the code does the updating.

    PHP Code:
    require "global.php";
    set_time_limit("60*10");


        
    $query "SELECT id FROM info ORDER BY id DESC";
        
    $result MYSQL_QUERY($query);
        
    $r mysql_fetch_array($result); 
        
    $signum $r["id"];

    for (
    $x 1$x <= $signum$x++) {

        
    $sql "SELECT * FROM info WHERE status = 'done' && id = '$x'";
        
    $resultID mysql_query($sql);
        
    $exist mysql_num_rows($resultID);

        if(
    $exist "0") { 
    If I plug values into the for statement, it does not work:
    PHP Code:
    for ($x "335"$x <= "450"$x++) { 
    s c r i p t s f o r y o u . n e t
    ScriptsForYou

  2. #2
    SitePoint Guru godsfshrmn's Avatar
    Join Date
    Mar 2001
    Posts
    671
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fixed it, there was something wrong with record 336 and stopped the script for some reason ?
    s c r i p t s f o r y o u . n e t
    ScriptsForYou


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
  •