[PHP] Why does this script run out of memory?

2011-10-28 Thread Jim Long
I'm running PHP 5.3.8 on FreeBSD 8.2 with MySQL 5.1.55. The script below is designed to be able to WHILE it's way through a MySQL query result set, and process each row. However, it runs out of memory a little after a quarter million rows. The schema fields total to about 200 bytes per row, so

Re: [PHP] Why does this script run out of memory?

2011-10-28 Thread Jim Long
On Fri, Oct 28, 2011 at 01:21:36PM -0400, Eric Butera wrote: On Fri, Oct 28, 2011 at 12:38 PM, Jim Long p...@umpquanet.com wrote: I'm running PHP 5.3.8 on FreeBSD 8.2 with MySQL 5.1.55. The script below is designed to be able to WHILE it's way through a MySQL query result set, and process

Re: Re: [PHP] Why does this script run out of memory?

2011-10-28 Thread Jim Long
On Fri, Oct 28, 2011 at 01:32:32PM -0400, James wrote: On Fri, Oct 28, 2011 at 12:38 PM, Jim Long p...@umpquanet.com wrote: I'm running PHP 5.3.8 on FreeBSD 8.2 with MySQL 5.1.55. The script below is designed to be able to WHILE it's way through a MySQL query result set, and process

Re: [PHP] BP for Looping through an Array

2011-10-28 Thread Jim Long
On Fri, Oct 28, 2011 at 12:09:24PM -0600, George Langley wrote: Hi all. Am wondering if there is a best practice for looping through an array, when you need both the item and its position (ie. 1, 2, 3). The two ways I know of: // the for loop tracks the position and you get each

Re: [PHP] Why does this script run out of memory?

2011-10-28 Thread Jim Long
On Fri, Oct 28, 2011 at 03:24:37PM -0400, Jim Giner wrote: If all you want to do is count the records, why are you not letting sql do it for you instead of doing the while loop? That's all that script is doing, if that is the exact code you ran. Hi, Jim. Thank you for replying. One of

Re: [PHP] Why does this script run out of memory?

2011-10-28 Thread Jim Long
On Fri, Oct 28, 2011 at 03:42:48PM -0400, Eric Butera wrote: On Fri, Oct 28, 2011 at 3:29 PM, Daniel Brown danbr...@php.net wrote: On Fri, Oct 28, 2011 at 13:25, Jim Long p...@umpquanet.com wrote: Eric: Thanks for your reply. process row here is a comment. ??It doesn't do anything

Re: [PHP] Why does this script run out of memory?

2011-10-28 Thread Jim Long
On Fri, Oct 28, 2011 at 02:57:02PM -0700, Tommy Pham wrote: On Fri, Oct 28, 2011 at 9:38 AM, Jim Long p...@umpquanet.com wrote: I'm running PHP 5.3.8 on FreeBSD 8.2 with MySQL 5.1.55. Jim, Installed from packages or standard port tree build? Did you do any tweak for the ports build

Re: [PHP] mysql_fetch_array() vs mysql_fetch_assoc() WAS: Re: [PHP] Why does this script run out of memory?

2011-10-28 Thread Jim Long
On Fri, Oct 28, 2011 at 06:19:56PM -0400, Daniel Brown wrote: On Fri, Oct 28, 2011 at 18:13, Paul Halliday paul.halli...@gmail.com wrote: Whats the difference between fetch_assoc and fetch_row? I use: while ($row = mysql_fetch_row($theQuery)) { ? ?doCartwheel; } on just under

[PHP] SORT_NUMERIC

2003-02-28 Thread Jim Long
when it sorts. TIA, Jim Long BTW: asort is the one I need as I must maintain the keys JanetVal Wrote: sort() sorts by value but assigns new keys as numbers. asort() sorts by value, but keeps the same keys ksort() sorts by key. THANKS ! -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | Jim

[PHP] strip comma from $value

2003-02-28 Thread Jim Long
); } } -- It passed the test but, I'm doing something wrong because the commas are still there. TIA, Jim Long Jim Long Wrote: Does anyone know how to make the flag sort_numeric work? Will it work with asort? asort ($numeric_array, SORT_NUMERIC); I've tried this but it looks like it's having problems

[PHP] re: strip comma from $value

2003-02-28 Thread Jim Long
.. any other ideas? Jim Long -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] re: strip comma from $value

2003-02-28 Thread Jim Long
Hi, Thanks to those who are helping me. Matt, Same result, echo's sucess, but commas are still out put in the $numeric_array. Jim Long Matt Wrote: foreach($numeric_array as $key = $value ) { if(strstr($value,,)) { $value = ereg_replace(,,,$value

[PHP] re: sort comma from $value

2003-02-28 Thread Jim Long
); $numeric_array[$key] = $value; //reset the output array echo comma stripped; } } Thanks again for all your help, Jim Long -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] sort mixed array

2003-02-27 Thread Jim Long
Hi, I have an array with an html link as key and different $vars as val: $list = array ( 'a href=http://someplace.com/;some place/a' = $vendor1_total, 'a href=http://anotherplace.com/;another place/a' = $vendor2__total, [snip] etc.. some vals are numeric and some vals are n/a asort works to

[PHP] restating plea for help with sort

2003-02-27 Thread Jim Long
to sort the array as a string, however, I need to sort the numeric vals numeric, then have the n/a's go away or be output at the bottom of the sort. Please be clear and gentle.. I'm not schooled in php, just a tinkerer trying to make this mess work. Thanks In Advance, Jim Long -- PHP General Mailing

[PHP] help with arrays

2003-02-27 Thread Jim Long
/a }else{ $plan_list = array ($key = $val);// need an array here for numeric vals } } Thanks In Advance, Jim Long -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] separating value=n/a from array

2003-02-27 Thread Jim Long
! HOWEVER: I think PHP is seeing a comma, in a large number and think that it IS NOT NUMERIC, because when I test a large number it put it in the $na_array Do I need to add something to this code to stip the commas? THANKS IN ADAVANCE AGAIN, Jim Long Kevin Stone wrote: To append my own answer

[PHP] PHP SORT_NUMERIC

2003-02-27 Thread Jim Long
Hi, I've got to sort the $numeric_arry This doesn't seem to work: sort ($numeric_array, SORT_NUMERIC); I think its sorting $key asort ($numeric_array, SORT_NUMERIC); sorts as a string THANKS AGAIN IN ADVANCE, Jim Long JanetVal Wrote: Well, as long as you know exactly what you are looking

[PHP] connecting to db

2002-08-21 Thread Jim Long
unselect it? FMI (forgive my ignorance): What connection script should I use? Thanks So Much in Advance, Jim Long -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] defining separate form element within While statment

2002-08-04 Thread Jim Long
Hi, I'm having trouble passing $the_score to edit_s1_php3: // Display the scores while ( $row = mysql_fetch_array($result) ) { echo( form . p . $row[last_name] . , . $row[first_name] . /p . $row[s1] . input type='text' name='the_score' size='3' . a

[PHP] sort and maintain varible names

2002-04-29 Thread Jim Long
I have a basic sort: $orderd_list = array ($onec_rounded_total, $aps_rounded_total, $bo_rounded_total, $cap3_rounded_total, $cap3_rounded_total, $cap_rounded_total, $cfl_rounded_total, $ecg_rounded_total, $ldd_rounded_total, $png_rounded_total, $spr_rounded_total, $ist917_rounded_total,

[PHP] simplify if/then statement

2002-04-27 Thread Jim Long
if ($state == AZ) { // include class include(CalcAZ.class.inc); } else{ echo Please select a State.br\n; } Thank You Very Much, Jim Long -- http://jimlong.net/web -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] simplify if/then statement

2002-04-27 Thread Jim Long
Using pull down for $state. This works great! $incfilename = Calc.$state..class.inc; if (file_exists($incfilename)) include($incfilename); else echo Please select a State.br\n; Thanks To Everyone, j -- http://jimlong.net/web I'd do something similar to this, along

[PHP] re: passing inputs

2002-03-13 Thread Jim Long
THANKS TO ERIK PRICE ! You ablility to explain php concepts in simple langauge is exactly why I signed up for this list! I will be deeply greatful for any other tutorials like this one on passing imputs. THANKS AGAIN, Jim Long Erik Price wrote: John, It seems that you're using two

[PHP] archive

2002-03-12 Thread Jim Long
Hello, Is there a searchable archive of this PHP- general subscriber list? Thanks in Advance, Jim Long -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php