php-general Digest 22 Jun 2011 14:15:31 -0000 Issue 7370

2011-06-22 Thread php-general-digest-help
php-general Digest 22 Jun 2011 14:15:31 - Issue 7370 Topics (messages 313635 through 313635): newbie date time question 313635 by: David Nicholls Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest,

[PHP] newbie date time question

2011-06-22 Thread David Nicholls
I'm trying to convert a date and time string using strtotime() The date and time strings are the first entry in each line in a csv file in the form: 22/06/2011 9:47:20 PM, data1, data2,... I've been trying to use the following approach, without success: function read_data($filename) {

Re: [PHP] newbie date time question

2011-06-22 Thread David Nicholls
On 23/06/11 12:23 AM, Adam Balogh wrote: hi, you have a PM(/AM) in your date ($d[0]), so put an A (Uppercase Ante meridiem and Post meridiem) format char to your $format variable. b3ha Thanks, Adam. Tried that and it's now throwing an error: Catchable fatal error: Object of class DateTime

[PHP] this newsgroup and OE

2011-06-22 Thread Jim Giner
Perhaps someone can tell me the secret to getting problem-free access to the php newsgroups using OE. I have two other newsgroup servers configured in OE which do not give me any difficulties at all. My setup for news.php.net however gives me nothing but problems. Inability to connect to

Re: [PHP] newbie date time question

2011-06-22 Thread David Nicholls
On 23/06/11 12:30 AM, Richard Quadling wrote: On 22 June 2011 15:05, David Nichollsd...@dcnicholls.com wrote: I'm trying to convert a date and time string using strtotime() The date and time strings are the first entry in each line in a csv file in the form: 22/06/2011 9:47:20 PM, data1,

Re: [PHP] newbie date time question

2011-06-22 Thread Adam Balogh
$dt is an object as the error says, so you cant echo it, becouse its not a string (it can be with __toString magic method, or use print_r/var_dump to output your object). Try the format ( http://www.php.net/manual/en/datetime.format.php) method on your $dt object. On Wed, Jun 22, 2011 at 4:41 PM,

Re: [PHP] newbie date time question

2011-06-22 Thread Richard Quadling
On 22 June 2011 15:05, David Nicholls d...@dcnicholls.com wrote: I'm trying to convert a date and time string using strtotime() The date and time strings are the first entry in each line in a csv file in the form: 22/06/2011 9:47:20 PM, data1, data2,... I've been trying to use the

Re: [PHP] newbie date time question

2011-06-22 Thread David Nicholls
OK, looks like I have fixed problem, using: $format = 'd/m/Y g:i:s A'; $dt = date_create_from_format($format, $d[0]); $dt2 = date('r', $dt-getTimestamp()); $data[] = array(strtotime($dt2), $d[1]); Not elegant but it gives me the date/time value. Thanks, Adam and

Re: [PHP] newbie date time question

2011-06-22 Thread Stuart Dallas
On Wednesday, 22 June 2011 at 15:59, David Nicholls wrote: OK, looks like I have fixed problem, using: $format = 'd/m/Y g:i:s A'; $dt = date_create_from_format($format, $d[0]); $dt2 = date('r', $dt-getTimestamp()); $data[] = array(strtotime($dt2), $d[1]); Not elegant but it gives

[PHP] Re: this newsgroup and OE

2011-06-22 Thread Shawn McKenzie
On 06/22/2011 09:45 AM, Jim Giner wrote: Perhaps someone can tell me the secret to getting problem-free access to the php newsgroups using OE. I have two other newsgroup servers configured in OE which do not give me any difficulties at all. My setup for news.php.net however gives me

[PHP] Re: newbie date time question

2011-06-22 Thread Shawn McKenzie
On 06/22/2011 09:05 AM, David Nicholls wrote: I'm trying to convert a date and time string using strtotime() The date and time strings are the first entry in each line in a csv file in the form: 22/06/2011 9:47:20 PM, data1, data2,... I've been trying to use the following approach,

[PHP] Re: this newsgroup and OE

2011-06-22 Thread Jim Giner
Well - it's a secret until one asks I guess. Thanks Shawn for the info. Since you say it's been happening for years, I guess there's no hope for resolution. Can you or someone else recommend a newsgroup client that functions better with this group? BTw - this is my second attempt to respond

Re: [PHP] jQuery to PHP

2011-06-22 Thread Tim Streater
On 22 Jun 2011 at 19:44, Ethan Rosenberg eth...@earthlink.net wrote: I have a PHP program which will generate a chess board with a form in the program. I wish to fill the form by clicking one of the squares in the chess board. I am trying to use jQuery and Aja to do this. The Ajax call

Re: [PHP] Updating to 5.3.6

2011-06-22 Thread Sean Greenslade
All I can suggest is either compile from source or find a different mac binary. I don't often deal with macs, much less try to use them as servers, so that's the best I can offer. Good luck. On Jun 20, 2011 1:53 PM, Bruno Coelho brunocsncoe...@gmail.com wrote:

Re: [PHP] jQuery to PHP

2011-06-22 Thread Jim Lucas
On 6/22/2011 12:43 PM, Tim Streater wrote: On 22 Jun 2011 at 19:44, Ethan Rosenberg eth...@earthlink.net wrote: I have a PHP program which will generate a chess board with a form in the program. I wish to fill the form by clicking one of the squares in the chess board. I am trying to use

Re: Re: [PHP] jQuery to PHP

2011-06-22 Thread Tim Streater
On 22 Jun 2011 at 20:56, Jim Lucas li...@cmsws.com wrote: On 22/6/2011 12:43 PM, Tim Streater wrote: On 22 Jun 2011 at 19:44, Ethan Rosenberg eth...@earthlink.net wrote: I have a PHP program which will generate a chess board with a form in the program. I wish to fill the form by clicking

Re: Re: Re: [PHP] jQuery to PHP

2011-06-22 Thread Tim Streater
On 22 Jun 2011 at 21:56, Ethan Rosenberg eth...@earthlink.net wrote: At 04:30 PM 6/22/2011, you wrote: On 22 Jun 2011 at 20:56, Jim Lucas li...@cmsws.com wrote: So the OP is using the form's action to reload the page, and seemingly making an ajax call under some circumstance that will also

[PHP] URL Rewriting

2011-06-22 Thread Silvio Siefke
Hello, is there a chance with php to use rewriting? Like Example: mysite.com/theme.php?id=1 to theme.php theme2.php etc. I have ask on the nginx list, but there they say i should use the power language php. When i search in google for Examples or Tutorials i only found mod_rewriting.

Re: [PHP] URL Rewriting

2011-06-22 Thread Fatih P.
try RewriteEngine on RewriteRule ^theme([0-9]+).php$ /index.php?theme=$1 [L] On Wed, Jun 22, 2011 at 11:22 PM, Silvio Siefke li...@silvio-siefke.dewrote: Hello, is there a chance with php to use rewriting? Like Example: mysite.com/theme.php?id=1 to theme.php theme2.php etc. I

Re: [PHP] URL Rewriting

2011-06-22 Thread Daniel Brown
On Wed, Jun 22, 2011 at 17:32, Fatih P. fatihpirist...@gmail.com wrote: try RewriteEngine on RewriteRule ^theme([0-9]+).php$  /index.php?theme=$1 [L] That's neither nginx nor PHP, so it's not really relevant to the OP's questions. -- /Daniel P. Brown Network Infrastructure Manager

Re: [PHP] URL Rewriting

2011-06-22 Thread Daniel P. Brown
On Wed, Jun 22, 2011 at 17:22, Silvio Siefke li...@silvio-siefke.de wrote: Hello, is there a chance with php to use rewriting? Like Example: mysite.com/theme.php?id=1 to theme.php theme2.php etc. I have ask on the nginx list, but there they say i should use the power language php. When

[PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Scott Baker
I have a bunch of records in a DB that look like id | parent_id -- 1 | 4 2 | 4 3 | 2 4 | 0 5 | 2 6 | 1 7 | 3 8 | 7 9 | 7 I want to build a big has that looks like: 4 - 1 - 6 - 2 - 3 - 7 - 9 - 5 - 8 I'm like 90% of the way there, but I can't get my recursive

Re: [PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Simon J Welsh
On 23/06/2011, at 9:53 AM, Scott Baker wrote: I have a bunch of records in a DB that look like id | parent_id -- 1 | 4 2 | 4 3 | 2 4 | 0 5 | 2 6 | 1 7 | 3 8 | 7 9 | 7 I want to build a big has that looks like: 4 - 1 - 6 - 2 - 3 - 7 - 9 - 5 -

Re: [PHP] URL Rewriting

2011-06-22 Thread Silvio Siefke
On Wed, 22 Jun 2011 17:50:49 -0400 Daniel P. Brown wrote: Has someone a Link with Tutorials or other Information? Not entirely sure what you're asking here, or how you (or the nginx folks) expect it to relate to PHP. Do you mean that you want to use PHP to have theme2.php act as if it

Re: [PHP] URL Rewriting

2011-06-22 Thread Silvio Siefke
On Wed, 22 Jun 2011 23:32:10 +0200 Fatih P. wrote: try RewriteEngine on RewriteRule ^theme([0-9]+).php$ /index.php?theme=$1 [L] That is rule for Apache i think. I have nginx, and there i have try much rules but nothing want work. And on the list from nginx the maintainer write, i should use

Re: [PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Simon J Welsh
On 23/06/2011, at 9:57 AM, Simon J Welsh wrote: On 23/06/2011, at 9:53 AM, Scott Baker wrote: I have a bunch of records in a DB that look like id | parent_id -- 1 | 4 2 | 4 3 | 2 4 | 0 5 | 2 6 | 1 7 | 3 8 | 7 9 | 7 I want to build a big has that looks

[PHP] Re: URL Rewriting

2011-06-22 Thread Geoff Lane
On Wednesday, June 22, 2011, Daniel Brown wrote: RewriteEngine on RewriteRule ^theme([0-9]+).php$  /index.php?theme=$1 [L] That's neither nginx nor PHP, so it's not really relevant to the OP's questions. I guess that the answer should be that you can rewrite outside of PHP and then make

Re: [PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Scott Baker
On 06/22/2011 03:06 PM, Simon J Welsh wrote: On further inspection, that's not the problem at all. The problem's around assign_children($pid,$list,$new); The previous line you defined $new with $new = $leaf[$pid], *copying* that node into $new. Thus the assign_children() call updates $new,

Re: [PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Simon J Welsh
On 23/06/2011, at 10:14 AM, Scott Baker wrote: On 06/22/2011 03:06 PM, Simon J Welsh wrote: On further inspection, that's not the problem at all. The problem's around assign_children($pid,$list,$new); The previous line you defined $new with $new = $leaf[$pid], *copying* that node into

Re: [PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Scott Baker
On 06/22/2011 03:17 PM, Simon J Welsh wrote: You still need to pass the value by reference to assign_children(), so: $new = $leaf[$pid]; assign_children($pid,$list,$new); Aha... that was it! Thanks! -- Scott Baker - Canby Telcom System Administrator - RHCE - 503.266.8253 -- PHP General

Re: [PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Scott Baker
On 06/22/2011 03:17 PM, Simon J Welsh wrote: You still need to pass the value by reference to assign_children(), so: $new = $leaf[$pid]; assign_children($pid,$list,$new); One last thing I fixed was that PHP was complaining that run-time pass by reference was deprecated. I changed

[PHP] help with an array if its possible!

2011-06-22 Thread Adam Preece
Hi Gang! i have 2 assoc arrays from 2 querys, first one is page categorys it consists of: id name second is pages name cat_id now, i am using smarty, so i pass arrays into the view. this i would like to pass to the view and display within a html select

[PHP] Re: this newsgroup and OE

2011-06-22 Thread Al
I've reported the issue Bugzilla two times, and others have also. On 6/22/2011 11:27 AM, Shawn McKenzie wrote: On 06/22/2011 09:45 AM, Jim Giner wrote: Perhaps someone can tell me the secret to getting problem-free access to the php newsgroups using OE. I have two other newsgroup servers

Re: [PHP] help with an array if its possible!

2011-06-22 Thread Daniel P. Brown
On Wed, Jun 22, 2011 at 18:43, Adam Preece a...@blueyonder.co.uk wrote: Hi Gang! i have 2 assoc arrays from 2 querys, first one is page categorys it consists of:        id        name second is pages        name        cat_id now, i am using smarty, so i pass arrays into the view.

[PHP] Re: newbie date time question

2011-06-22 Thread David Nicholls
On 23/06/11 1:35 AM, Shawn McKenzie wrote: On 06/22/2011 09:05 AM, David Nicholls wrote: I'm trying to convert a date and time string using strtotime() The date and time strings are the first entry in each line in a csv file in the form: 22/06/2011 9:47:20 PM, data1, data2,... I've been

Re: [PHP] newbie date time question

2011-06-22 Thread David Nicholls
On 23/06/11 1:02 AM, Stuart Dallas wrote: On Wednesday, 22 June 2011 at 15:59, David Nicholls wrote: OK, looks like I have fixed problem, using: $format = 'd/m/Y g:i:s A'; $dt = date_create_from_format($format, $d[0]); $dt2 = date('r', $dt-getTimestamp()); $data[] =

[PHP] Re: newbie date time question

2011-06-22 Thread Shawn McKenzie
On 06/22/2011 06:54 PM, David Nicholls wrote: I'm late to the party, but strtotime works great, though you need to give it what it expects: $ts = strtotime(str_replace('/', '-', $date)); Thanks, Shawn, that's a bit more elegant! I'll give it a go. I didn't know how to do the str_relace

Re: [PHP] help with an array if its possible!

2011-06-22 Thread Jim Lucas
On 6/22/2011 3:43 PM, Adam Preece wrote: Hi Gang! i have 2 assoc arrays from 2 querys, first one is page categorys it consists of: id name second is pages name cat_id now, i am using smarty, so i pass arrays into the view. this i would like to pass to

[PHP] Re: newbie date time question

2011-06-22 Thread David Nicholls
On 23/06/11 10:04 AM, Shawn McKenzie wrote: On 06/22/2011 06:54 PM, David Nicholls wrote: I'm late to the party, but strtotime works great, though you need to give it what it expects: $ts = strtotime(str_replace('/', '-', $date)); Thanks, Shawn, that's a bit more elegant! I'll give it a