php-general Digest 28 Oct 2011 08:18:47 -0000 Issue 7541

2011-10-28 Thread php-general-digest-help
php-general Digest 28 Oct 2011 08:18:47 - Issue 7541 Topics (messages 315456 through 315480): Re: Exporting large data from mysql to html using php 315456 by: Jim Giner 315467 by: Jason Pruim 315468 by: Jason Pruim Question reading a file 315457 by: Tedd

Re: [PHP] Help with redeclare error

2011-10-28 Thread Ashley Sheridan
On Thu, 2011-10-27 at 17:40 -0700, UltraMega Admin wrote: On 10/27/2011 5:33 PM, Daniel Brown wrote: On Thu, Oct 27, 2011 at 20:06, Jason Pruimli...@pruimphotography.com wrote: Most likely you have in included in 2 files... Look into it from that angle... It only needs to be included

Re: [PHP] array_unique by id multi-dimensional array

2011-10-28 Thread Tontonq Tontonq
let me explain again this is my array Array ( [0] = Array ( [likes] = 137846 [name] = blabla [access_token] = AAABZBD [id] = 157644197612598 [link] = http://www.facebook.com/blabla ) [1] = Array ( [likes] = 137698 [name] = blabla [access_token] = AAAnnL [id] = 157644197612598 [link] =

Re: [PHP] array_unique by id multi-dimensional array

2011-10-28 Thread sivaji j.g
On Fri, Oct 28, 2011 at 1:22 PM, Tontonq Tontonq root...@gmail.com wrote: let me explain again this is my array Array ( [0] = Array ( [likes] = 137846 [name] = blabla [access_token] = AAABZBD [id] = 157644197612598 [link] = http://www.facebook.com/blabla ) [1] = Array ( [likes] =

Re: [PHP] array_unique by id multi-dimensional array

2011-10-28 Thread Tontonq Tontonq
thanks it works 2011/10/28 sivaji j.g sivaji2...@gmail.com On Fri, Oct 28, 2011 at 1:22 PM, Tontonq Tontonq root...@gmail.comwrote: let me explain again this is my array Array ( [0] = Array ( [likes] = 137846 [name] = blabla [access_token] = AAABZBD [id] = 157644197612598 [link] =

[PHP] 求正则

2011-10-28 Thread yuxiangye
http://jingji.cntv.cn/yaowen/20111027.shtml 获取该网站源码的url的php的正 则表达式 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] 求正则

2011-10-28 Thread Sharl.Jimh.Tsin
在 2011-10-28五的 16:35 +0800,yuxiangye写道: http://jingji.cntv.cn/yaowen/20111027.shtml 获取该网站源码的url的php的正 则表达式 i can not get you clearly. 不懂你的意思~ -- Best regards, Sharl.Jimh.Tsin (From China **Obviously Taiwan INCLUDED**) Using Gmail? Please read this important notice:

Re: [PHP] Friday Distraction

2011-10-28 Thread Adam Richardson
On Thu, Oct 27, 2011 at 10:18 AM, Richard Quadling rquadl...@gmail.comwrote: On 21 October 2011 17:27, Daniel Brown danbr...@php.net wrote: I'll get this week's Friday distraction kicked off here with something shared with me by a Facebook friend. If you're on Facebook, try this. It's

[PHP] want to get Regular Expressions

2011-10-28 Thread yuxiangye
get the url form the source of http://jingji.cntv.cn/yaowen/20111027.shtml withRegular Expressions. I want to get the Regular Expressions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] want to get Regular Expressions

2011-10-28 Thread Ashley Sheridan
yuxiangye yuxian...@gmail.com wrote: get the url form the source of http://jingji.cntv.cn/yaowen/20111027.shtml withRegular Expressions. I want to get the Regular Expressions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Erm, say what

Re: [PHP] Execute permission question

2011-10-28 Thread Geoff Shang
On Thu, 27 Oct 2011, Tedd Sperling wrote: You answered a question I wasn't prepared to ask, which was How can php scripts be executed when their execute permissions aren't set? Because as far as the system is concerned, the thing which is being executed is either PHP itself or something in

Re: [PHP] Friday Distraction

2011-10-28 Thread Daniel Brown
On Fri, Oct 28, 2011 at 05:03, Adam Richardson simples...@gmail.com wrote: Well, Daniel, I'll bet you never thought that your Friday Distraction would elicit such a broad range of responses AND keep the commentary coming right through to the next Friday. Nice :) This is nothing compared

Re: [PHP] want to get Regular Expressions

2011-10-28 Thread Negin Nickparsa
you want to get which part of the url? On 10/28/11, Ashley Sheridan a...@ashleysheridan.co.uk wrote: yuxiangye yuxian...@gmail.com wrote: get the url form the source of http://jingji.cntv.cn/yaowen/20111027.shtml withRegular Expressions. I want to get the Regular Expressions -- PHP General

Re: [PHP] Friday Distraction

2011-10-28 Thread Stuart Dallas
On 28 Oct 2011, at 12:54, Daniel Brown wrote: On Fri, Oct 28, 2011 at 05:03, Adam Richardson simples...@gmail.com wrote: Well, Daniel, I'll bet you never thought that your Friday Distraction would elicit such a broad range of responses AND keep the commentary coming right through to the

RE: [PHP] Help with redeclare error

2011-10-28 Thread Jack
A function with that name already exists in PHP as of 5.3.0. You'll have to rename it or something. http://us2.php.net/manual/en/function.date-diff.php That looks like what happened that new function was added and we had written one with the same name from the stone age... Thanks! --

Re: [PHP] Execute permission question

2011-10-28 Thread Tedd Sperling
On Oct 28, 2011, at 7:19 AM, Geoff Shang wrote: On Thu, 27 Oct 2011, Tedd Sperling wrote: You answered a question I wasn't prepared to ask, which was How can php scripts be executed when their execute permissions aren't set? Because as far as the system is concerned, the thing which is

Re: [PHP] Execute permission question

2011-10-28 Thread Tedd Sperling
On Oct 27, 2011, at 7:49 PM, Daniel Brown wrote: On Thu, Oct 27, 2011 at 19:44, Tedd Sperling tedd.sperl...@gmail.com wrote: One of the things I'm trying to understand is a php script can execute a shell command, right? Is there a way via permissions to prevent that -- or -- does that

Re: [PHP] Execute permission question

2011-10-28 Thread Daniel Brown
On Fri, Oct 28, 2011 at 11:01, Tedd Sperling tedd.sperl...@gmail.com wrote: But does having execute permissions set on a script affect the scripts ability to run shell commands? Negative. It won't inherit permissions, though one might expect that to make sense. For example, if I have a

Re: [PHP] Friday Distraction

2011-10-28 Thread Tedd Sperling
On Oct 28, 2011, at 9:43 AM, Stuart Dallas wrote On 28 Oct 2011, at 12:54, Daniel Brown wrote: On Fri, Oct 28, 2011 at 05:03, Adam Richardson simples...@gmail.com wrote: Well, Daniel, I'll bet you never thought that your Friday Distraction would elicit such a broad range of responses AND keep

Re: [PHP] Execute permission question

2011-10-28 Thread Tedd Sperling
On Oct 28, 2011, at 11:07 AM, Daniel Brown wrote: On Fri, Oct 28, 2011 at 11:01, Tedd Sperling tedd.sperl...@gmail.com wrote: But does having execute permissions set on a script affect the scripts ability to run shell commands? Negative. It won't inherit permissions, though one might

Re: Re: [PHP] Execute permission question

2011-10-28 Thread Tim Streater
On 28 Oct 2011 at 16:01, Tedd Sperling tedd.sperl...@gmail.com wrote: On Oct 27, 2011, at 7:49 PM, Daniel Brown wrote: But does having execute permissions set on a script affect the scripts ability to run shell commands? No, as Dan has said. But if you have a file called wiggy, containing

Re: [PHP] Friday Distraction

2011-10-28 Thread Eric Butera
On Fri, Oct 28, 2011 at 11:16 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Oct 28, 2011, at 9:43 AM, Stuart Dallas wrote On 28 Oct 2011, at 12:54, Daniel Brown wrote: On Fri, Oct 28, 2011 at 05:03, Adam Richardson simples...@gmail.com wrote: Well, Daniel, I'll bet you never thought

Re: [PHP] Friday Distraction

2011-10-28 Thread Daniel Brown
On Fri, Oct 28, 2011 at 11:51, Eric Butera eric.but...@gmail.com wrote: Mr Brown, You're not going to try and pawn this thread off as the Friday Distraction, are you? No, I'm waiting for someone else to set themselves on fire in front of the crowd of onlookers this week. My email

Re: [PHP] Friday Distraction

2011-10-28 Thread Eric Butera
On Fri, Oct 28, 2011 at 12:02 PM, Daniel Brown danbr...@php.net wrote: On Fri, Oct 28, 2011 at 11:51, Eric Butera eric.but...@gmail.com wrote: Mr Brown, You're not going to try and pawn this thread off as the Friday Distraction, are you?    No, I'm waiting for someone else to set

[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

[PHP] Object size

2011-10-28 Thread QI.VOLMAR QI
Is there a function or method that calculate the object size in PHP?. Or maybe that calculates a xml buffer of a file? I need to check a size of a file, and if it's size is bigger than 500kb. I will need to make another file to the subsequent content. Any help will serve. Tks, Volmar -- PHP

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

2011-10-28 Thread Eric Butera
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 each row. However, it runs out of memory a little after a

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 James
Original Message From: Eric Butera eric.but...@gmail.com To: Jim Long p...@umpquanet.com Cc: php-general@lists.php.net Sent: Fri, Oct 28, 2011, 1:22 PM Subject: Re: [PHP] Why does this script run out of memory? On Fri, Oct 28, 2011 at 12:38 PM, Jim Long p...@umpquanet.com wrote: I'm

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

2011-10-28 Thread Ashley Sheridan
On Fri, 2011-10-28 at 13:32 -0400, James wrote: Original Message From: Eric Butera eric.but...@gmail.com To: Jim Long p...@umpquanet.com Cc: php-general@lists.php.net Sent: Fri, Oct 28, 2011, 1:22 PM Subject: Re: [PHP] Why does this script run out of memory? On Fri, Oct 28,

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

[PHP] BP for Looping through an Array

2011-10-28 Thread George Langley
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 item from the array $allFiles = array(coffee.jpg, tea.jpg,

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 Giner
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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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

2011-10-28 Thread Daniel Brown
On Fri, Oct 28, 2011 at 14:05, Jim Long p...@umpquanet.com wrote: the tail end of the output becomes:  274695    134202232  274696    134202672  274697    134203112  274698    134203552  274699    134203992 PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to

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

2011-10-28 Thread Daniel Brown
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.  The script, exactly as shown, runs out of memory, exactly as shown. My response presumes that you're planning on placing something

Re: [PHP] BP for Looping through an Array

2011-10-28 Thread Daniel Brown
On Fri, Oct 28, 2011 at 14:18, Jim Long p...@umpquanet.com wrote: If you are certain that your array is consecutively indexed from 0, you can shave two lines off your code with:        $allFiles = array(coffee.jpg, tea.jpg, milk.jpg);        foreach ($allFiles as $key = $currFile) {        

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 Eric Butera
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.  The script, exactly as shown, runs out of memory, exactly as shown.

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

2011-10-28 Thread Daniel Brown
On Fri, Oct 28, 2011 at 16:21, Jim Long p...@umpquanet.com wrote: I will try experimenting with Daniel's idea of unbuffered queries, but my understanding is that while an unbuffered result resource is in use, no other SQL transactions can be conducted. Maybe I can get around that by using one

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 Tommy Pham
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? Any special compiler parameters in your make.conf? I've noticed

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

2011-10-28 Thread Paul Halliday
On Fri, Oct 28, 2011 at 1: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 each row. However, it runs out of memory a little after a

Re: [PHP] Object size

2011-10-28 Thread Tommy Pham
On Fri, Oct 28, 2011 at 9:43 AM, QI.VOLMAR QI qi.vol...@gmail.com wrote: Is there a function or method that calculate the object size in PHP?. Or maybe that calculates a xml buffer of a file? I need to check a size of a file, and if it's size is bigger than 500kb. I will need to make another

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

2011-10-28 Thread Daniel Brown
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 300 million rows and nothing craps out. I have memory_limit set to 4GB

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?

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

2011-10-28 Thread Paul Halliday
On Fri, Oct 28, 2011 at 7:19 PM, Daniel Brown danbr...@php.net 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 300

[PHP] Friday Distraction

2011-10-28 Thread Nathan Nobbe
Hi gang, Thinking database i/o would be the slowest part of a request in your new zf / amf app? Leave it to Zend_Amf to burn more cycles marshaling the protocol! http://s289.photobucket.com/albums/ll238/quickshiftin/?action=viewcurrent=ScreenShot2011-10-24at74724PM.png Happy Halloween!

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

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

2011-10-28 Thread Daniel Brown
On Fri, Oct 28, 2011 at 18:48, Jim Long p...@umpquanet.com wrote: I'm not seeing any numeric keys in my mysql_fetch_assoc() arrays. You're absolutely correct, that's my mistake: substitute mysql_fetch_row() for mysql_fetch_assoc(). Duh. Time to call it a week -- /Daniel P. Brown

Re: [PHP] Friday Distraction

2011-10-28 Thread Daniel Brown
On Fri, Oct 28, 2011 at 18:36, Nathan Nobbe quickshif...@gmail.com wrote: Hi gang, Thinking database i/o would be the slowest part of a request in your new zf / amf app? Leave it to Zend_Amf to burn more cycles marshaling the protocol!

Re: [PHP] Friday Distraction

2011-10-28 Thread Eric Butera
On Fri, Oct 28, 2011 at 7:07 PM, Daniel Brown danbr...@php.net wrote: On Fri, Oct 28, 2011 at 18:36, Nathan Nobbe quickshif...@gmail.com wrote: Hi gang, Thinking database i/o would be the slowest part of a request in your new zf / amf app? Leave it to Zend_Amf to burn more cycles marshaling

Re: [PHP] Friday Distraction

2011-10-28 Thread Nathan Nobbe
On Fri, Oct 28, 2011 at 5:23 PM, Eric Butera eric.but...@gmail.com wrote: On Fri, Oct 28, 2011 at 7:07 PM, Daniel Brown danbr...@php.net wrote: On Fri, Oct 28, 2011 at 18:36, Nathan Nobbe quickshif...@gmail.com wrote: Hi gang, Thinking database i/o would be the slowest part of a request

Re: [PHP] Friday Distraction

2011-10-28 Thread Eric Butera
On Fri, Oct 28, 2011 at 7:24 PM, Nathan Nobbe quickshif...@gmail.com wrote: On Fri, Oct 28, 2011 at 5:23 PM, Eric Butera eric.but...@gmail.com wrote: On Fri, Oct 28, 2011 at 7:07 PM, Daniel Brown danbr...@php.net wrote: On Fri, Oct 28, 2011 at 18:36, Nathan Nobbe quickshif...@gmail.com

Re: [PHP] Friday Distraction

2011-10-28 Thread Nathan Nobbe
On Fri, Oct 28, 2011 at 5:26 PM, Eric Butera eric.but...@gmail.com wrote: On Fri, Oct 28, 2011 at 7:24 PM, Nathan Nobbe quickshif...@gmail.com wrote: On Fri, Oct 28, 2011 at 5:23 PM, Eric Butera eric.but...@gmail.com wrote: On Fri, Oct 28, 2011 at 7:07 PM, Daniel Brown

[PHP] Re:

2011-10-28 Thread Nirmalya Lahiri
.Do you want to feel orgasms several times? http://macrokid.ma.funpic.de/com.friend.page.php?jroyahoo_id=09ep0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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

2011-10-28 Thread shiplu
I had a spider written in PHP long ago. I had similar problems. because there were millions of rows of urls and I was fetching them in one single query. See inline, could this modification help you. Please test. On Fri, Oct 28, 2011 at 10:38 PM, Jim Long p...@umpquanet.com wrote: I'm running