Re: [PHP] How does this code work?

2012-07-02 Thread Jim Lucas
On 7/2/2012 7:15 PM, Robert Williams wrote: I found this code in a user comment in the PHP docs for htmlentities(): $v) $trans[$k]= "&#".ord($k).";"; return strtr($string, $trans); } ?> It seems to work. For instance, this (assuming UTF-8 encoding): echo xml_character_encode('Château'); echo

[PHP] How does this code work?

2012-07-02 Thread Robert Williams
I found this code in a user comment in the PHP docs for htmlentities(): $v) $trans[$k]= "&#".ord($k).";"; return strtr($string, $trans); } ?> It seems to work. For instance, this (assuming UTF-8 encoding): echo xml_character_encode('Château'); echo "\n"; echo xml_character_encode('Ch&teau');

Re: [PHP] PDO Prevent duplicate field names?

2012-07-02 Thread Jim Lucas
On 07/02/2012 03:38 PM, Scott Baker wrote: On 07/02/2012 03:34 PM, Matijn Woudt wrote: Why the would you want to return 2 columns with the same name? To be short, there's no such function, so you have to: 1) Rename one of the columns 2) or, use fetch_row with numerical indexes instead of fe

Re: [PHP] PDO Prevent duplicate field names?

2012-07-02 Thread Matijn Woudt
On Tue, Jul 3, 2012 at 12:38 AM, Scott Baker wrote: > On 07/02/2012 03:34 PM, Matijn Woudt wrote: >> Why the would you want to return 2 columns with the same name? >> To be short, there's no such function, so you have to: >> 1) Rename one of the columns >> 2) or, use fetch_row with numerical

Re: [PHP] PDO Prevent duplicate field names?

2012-07-02 Thread Scott Baker
On 07/02/2012 03:34 PM, Matijn Woudt wrote: > Why the would you want to return 2 columns with the same name? > To be short, there's no such function, so you have to: > 1) Rename one of the columns > 2) or, use fetch_row with numerical indexes instead of fetch_assoc. My "real world" scenario w

Re: [PHP] PDO Prevent duplicate field names?

2012-07-02 Thread Matijn Woudt
On Tue, Jul 3, 2012 at 12:25 AM, Scott Baker wrote: > $sql = "SELECT First, Last, Age, 'Foobar' AS Last;"; > > This is a simplified example of a SQL query where we're returning two > fields with the same name (Last). When I do a fetch_assoc with this > query I only get three fields, as the second

[PHP] PDO Prevent duplicate field names?

2012-07-02 Thread Scott Baker
$sql = "SELECT First, Last, Age, 'Foobar' AS Last;"; This is a simplified example of a SQL query where we're returning two fields with the same name (Last). When I do a fetch_assoc with this query I only get three fields, as the second "Last" field over writes the first one. I was hoping there wa

RE: [PHP] PHP Time

2012-07-02 Thread Rob Weissenburger
That worked just perfectly. Thank you. -Original Message- From: paras...@gmail.com [mailto:paras...@gmail.com] On Behalf Of Daniel Brown Sent: Monday, July 02, 2012 3:02 PM To: Rob Weissenburger Cc: php-general@lists.php.net Subject: Re: [PHP] PHP Time On Mon, Jul 2, 2012 at 4:00 PM, Rob

Re: [PHP] PHP Time

2012-07-02 Thread Geoff Shang
On Mon, 2 Jul 2012, Rob Weissenburger wrote: I know php time() gives the current unix time which you can format out to a normal date and time. Is there a way to format a specific date and time back to unix time? mktime() and strtotime() will do it, depending on the form your time is in. The

Re: [PHP] PHP Time

2012-07-02 Thread Daniel Brown
On Mon, Jul 2, 2012 at 4:00 PM, Rob Weissenburger wrote: > Hello everyone, > > I know php time() gives the current unix time which you can format out to > a normal date and time. Is there a way to format a specific date and time > back to unix time? Yup. Look at strtotime() and mktime():

[PHP] PHP Time

2012-07-02 Thread Rob Weissenburger
Hello everyone, I know php time() gives the current unix time which you can format out to a normal date and time. Is there a way to format a specific date and time back to unix time? Thanks for any help.

Re: [PHP] Way to test if variable contains valid date

2012-07-02 Thread Ron Piggott
On Mon, Jul 2, 2012 at 2:54 PM, Ron Piggott wrote: Is there a way to test a variable contains a valid date - 4 digits for the year - 2 digits for the month (including leading 0) - 2 digits for the day (including leading 0) OR - a function? You may want to check out checkdate(): h

Re: [PHP] Way to test if variable contains valid date

2012-07-02 Thread Daniel Brown
On Mon, Jul 2, 2012 at 2:54 PM, Ron Piggott wrote: > > Is there a way to test a variable contains a valid date > - 4 digits for the year > - 2 digits for the month (including leading 0) > - 2 digits for the day (including leading 0) > > OR > > - a function? You may want to check out checkdate

Re: [PHP] Destructor not called when extending SimpleXMLElement

2012-07-02 Thread Matijn Woudt
On Mon, Jul 2, 2012 at 1:58 PM, Nick Chalk wrote: > Afternoon all. > > I seem to be having a little trouble with extending the > SimpleXMLElement class. I would like to add a destructor to the > subclass, but am finding that it is not called. > > Attached is a minimal demonstration of the problem.

Re: [PHP] embedding php inside of php

2012-07-02 Thread Matijn Woudt
Hi, First a message to the ones that have responded before me: You're correct about the nested php tags that are not doing what the OP wanted, but you might want to take a closer look at the error that's in the logs. In ANY CASE PHP SHOULD NOT CRASH. What if the OP really wanted to print PHP tags

Re: [PHP] log tailing

2012-07-02 Thread Matijn Woudt
On Mon, Jul 2, 2012 at 3:23 PM, Mihamina Rakotomandimby wrote: > On 06/30/2012 09:32 PM, Daniel Brown wrote: >>> >>> >> $ssh_entries = explode(PHP_EOL,trim(`tail /var/log/syslog | awk >>> {'print $1,$2,$3 "|" $5 "|" $11'}`)); > > > This will tail a default number of lines. > > I'm looking for a wa

[PHP] PHP/mySQL Developer Partner needed...

2012-07-02 Thread Don Wieland
Greetings, I have a site that I am developing and I am looking to partner/ developer with great php/mySQL skills (for share of potential profits) to assist me in finishing this site. I am looking for someone who can invest (like myself) their time and skills to complete the site in exchang

Re: [PHP] embedding php inside of php

2012-07-02 Thread Daniel Brown
On Sat, Jun 30, 2012 at 8:00 PM, Tim Dunphy wrote: > Hello, > > I am trying to get the hang of php using some examples that I found > in a book. I've been making progress lately, but one thing has me a > bit stumped. > > > In an HTML form that I am echoing through PHP I would like to embed > smal

Re: [PHP] log tailing

2012-07-02 Thread Mihamina Rakotomandimby
On 06/30/2012 09:32 PM, Daniel Brown wrote: This will tail a default number of lines. I'm looking for a way to identify the last line, and when launching the PHP script I get the added line between now and that last one. There is a "logtail" utility in the "logtool" package, but I want a fu

Re: [PHP] Destructor not called when extending SimpleXMLElement

2012-07-02 Thread Erwin Poeze
Interesting problem. I would expect it to work too. I assume it is a bug. 2012/7/2 Nick Chalk > Afternoon all. > > I seem to be having a little trouble with extending the > SimpleXMLElement class. I would like to add a destructor to the > subclass, but am finding that it is not called. > > Atta

[PHP] Destructor not called when extending SimpleXMLElement

2012-07-02 Thread Nick Chalk
Afternoon all. I seem to be having a little trouble with extending the SimpleXMLElement class. I would like to add a destructor to the subclass, but am finding that it is not called. Attached is a minimal demonstration of the problem. The XMLConfig class extends SimpleXMLElement, and its destruct

RE: [PHP] Re: php form action breaks script

2012-07-02 Thread Ford, Mike
> -Original Message- > From: Tim Dunphy [mailto:bluethu...@gmail.com] > Sent: 28 June 2012 01:18 > > Hey guys, > > It's been a little while since I've toyed with this, and I hope you > don't mind my coming back to you for some more advice. But I've > enjoyed some limited success with Davi

Re: [PHP] Hello again

2012-07-02 Thread tamouse mailing lists
On Sun, Jul 1, 2012 at 6:21 PM, RGraph.net support wrote: > Just thought I'd say hello again. Back to brush up on my PHP a little > after a bit of a break - more reading than replying I'd imagine. I > have some pretty bad jokes too that I might surreptitiously insert > here and there... Welcome b