By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,420 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

PHP/Apache eating up hard-drive memory

100+
P: 110
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.
Expand|Select|Wrap|Line Numbers
  1.  
  2.     $resultShowExist = mysql_query($doesShowExist) or die('could not find if show exists');
  3.  $showsListFromDb=array();
  4.  while($checkShowExist = mysql_num_rows($resultShowExist)){
  5.         $showTitle=$checkShowExist['title'];
  6.         $showAddress=$checkShowExist['address'];
  7.                 $showCity=$checkShowExist['city'];
  8.         $showState=$checkShowExist['state'];
  9.         $showZip=$checkShowExist['zip'];
  10.         $showDate=$checkShowExist['date'];
  11.         $showTime==$checkShowExist['time'];
  12.             $mysqlShowsToArray=$showDateTime .' '. $showTime.','. $showTitle.','. $showAddress.','. $showCity.','. $showState.','. $showZip;
  13.  echo $mysqlShowsToArry.'<br>'; 
  14.  array_push($showsListFromDb, $mysqlShowsToArray);
  15.  
  16.  
  17.  
  18.   }
  19. echo"shows List from DB <br>";
  20.   print_r($showsListFromdb);
  21.  
Sep 29 '08 #1
Share this Question
Share on Google+
2 Replies


Atli
Expert 5K+
P: 5,058
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_array.
Sep 29 '08 #2

100+
P: 110
Damn my eyes!!!

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


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_array.
Sep 29 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.