PHP/Apache eating up hard-drive memory

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pedalpete
    New Member
    • Oct 2007
    • 109

    PHP/Apache eating up hard-drive memory

    Hi Gang,

    I've run into a serious problem, and can't seem to find the issue in my somewhat simple code.
    I've got a database and I update it with concert listings.
    I need to check if the new updates are already in the db, and the code I have is currently a mess so I decided to try using array_diff to find the new vs. old shows.

    Getting the list of updates into an array is no problem, but getting the list of shows from my db into array format so that I can compare the two is proving to be quite difficult.

    I've pinned down the error to be somewhere in the following code, but I can't seem to see anything that would cause anything to be written to my drive.

    I'd point to the dev code, but that would kill my 'puter, so I can't do that.
    The sql executes flawlessly and quickly, so that is not the answer.

    However, the page will never finish loading.
    Code:
    	$resultShowExist = mysql_query($doesShowExist) or die('could not find if show exists');
     $showsListFromDb=array();
     while($checkShowExist = mysql_num_rows($resultShowExist)){
    		$showTitle=$checkShowExist['title'];
    		$showAddress=$checkShowExist['address'];
    				$showCity=$checkShowExist['city'];
    		$showState=$checkShowExist['state'];
    		$showZip=$checkShowExist['zip'];
    		$showDate=$checkShowExist['date'];
    		$showTime==$checkShowExist['time'];
    			$mysqlShowsToArray=$showDateTime .' '. $showTime.','. $showTitle.','. $showAddress.','. $showCity.','. $showState.','. $showZip;
     echo $mysqlShowsToArry.'<br>'; 
     array_push($showsListFromDb, $mysqlShowsToArray);
    		
    		
    
      }
    echo"shows List from DB <br>";
      print_r($showsListFromdb);
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    I would guess the problem is on line 4, where you create a while loop using the mysql_num_rows function as the condition. The function is always checking how many results your query returned, which never changes, causing an indefinite loop.

    I'm pretty sure you were meaning to use mysql_fetch_arr ay.

    Comment

    • pedalpete
      New Member
      • Oct 2007
      • 109

      #3
      Damn my eyes!!!

      You are a good man Atli,
      thank you once again.


      Originally posted by Atli
      Hi.

      I would guess the problem is on line 4, where you create a while loop using the mysql_num_rows function as the condition. The function is always checking how many results your query returned, which never changes, causing an indefinite loop.

      I'm pretty sure you were meaning to use mysql_fetch_arr ay.

      Comment

      Working...