[SOLVED] Why is this causing my server to run out of memory?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
stsr11
Forum Newbie
Posts: 17
Joined: Thu Jul 15, 2004 6:57 pm

Why is this causing my server to run out of memory?

Post by stsr11 »

The following code should not have any effect at all, but it causes my PHP server to run out of allocated RAM. If you echo the output to a screen it appears to be adding new $data[] array elements until it crashes. Am I doing something completely stupid or is this a bug?

Code: Select all

$res = mysql_query("select * from table limit 0,10");
while ($data = mysql_fetch_array($res)) 
&#123; for ($i=0;$i<count($data);$i++) &#123; $data&#1111;$i] = $data&#1111;$i]; &#125; &#125;
stsr11
Forum Newbie
Posts: 17
Joined: Thu Jul 15, 2004 6:57 pm

Post by stsr11 »

Ignore this I found the answer!!!
Post Reply