[PHP] Re: How to pass POST data to php-cgi

2008-03-16 Thread Hui Chen
I solved the problem myself. Following command works: export CONTENT_LENGTH=4; export REQUEST_METHOD=POST; export SCRIPT_FILENAME= test.php ; export CONTENT_TYPE=application/x-www-form-urlencoded; echo s=44 | php-cgi output: X-Powered-By: PHP/5.2.3-1ubuntu6.3 Content-type: text/html 44 a wor

Re: [PHP] Re: problem with this regex to remove img tag...

2008-03-16 Thread Ryan A
Thanks guys! This (From Tul/Sokolewicz): $html = preg_replace('#(<[/]?img.*>)#U', '', $html); worked perfectly! I'm just learning this stuff so its extremly hard for me... i have been messing around with PHP for years but rarely even dipped my toes into the REGEX part as I think it would be e

[PHP] How to pass POST data to php-cgi

2008-03-16 Thread Hui Chen
Hi, I'm writing a simple httpd with php support via cgi/fastcgi. I tried several ways to pass POST data to php-cgi (by writing to child process's stdin from parent process), however, none of them worked Here's the most simple not working example: $ export CONTENT_LENGTH=4; export HTTP_METHOD=POS

Re: [PHP] Re: problem with this regex to remove img tag...

2008-03-16 Thread M. Sokolewicz
Jim Lucas wrote: M. Sokolewicz wrote: Ryan A wrote: Hey All, After searching I found this regex to remove img tags from a post, but running it is giving me an error, being a total noob with regex i have no idea what the heck is wrong heres the whole script as its tiny: $html = " hello

Re: [PHP] Re: problem with this regex to remove img tag...

2008-03-16 Thread Jim Lucas
M. Sokolewicz wrote: Ryan A wrote: Hey All, After searching I found this regex to remove img tags from a post, but running it is giving me an error, being a total noob with regex i have no idea what the heck is wrong heres the whole script as its tiny: $html = " hello ".'width="272" hei

Re: [PHP] Objects as array key names??

2008-03-16 Thread Jim Lucas
Sorry for the long post, but I thought it would explain much of my thinking... Anyway, here we go... Jeremy Mcentire wrote: You may have meant the while loop to iterate over $row = fetch_object($res) ... You are correct, I was simply trying to get the concept across. But you are correct,

[PHP] Re: problem with this regex to remove img tag...

2008-03-16 Thread M. Sokolewicz
Ryan A wrote: Hey All, After searching I found this regex to remove img tags from a post, but running it is giving me an error, being a total noob with regex i have no idea what the heck is wrong heres the whole script as its tiny: '. " Paul! "; $html = preg_replace('\s]+))?)+\s*|\s*)/?

[PHP] problem with this regex to remove img tag...

2008-03-16 Thread Ryan A
Hey All, After searching I found this regex to remove img tags from a post, but running it is giving me an error, being a total noob with regex i have no idea what the heck is wrong heres the whole script as its tiny: '. " Paul! "; $html = preg_replace('\s]+))?)+\s*|\s*)/?>', '', $html);

[PHP] __halt_compiler()

2008-03-16 Thread Casey
Hi list! __halt_compiler(). Does anyone use it? I've used it obsessively in my past two "projects" to store data (specifically CSV) in the PHP files. These two "projects" consisted of only one file, and I didn't want to clutter everything and involve databases and/or XML files. Your thoughts? -

[PHP] Re: DOM - Question about \0

2008-03-16 Thread Rob Richards
dav wrote: Hi, I have question about \0 character with DOM : What to do with the character \0 ? encode this character to obtain : ? or skip the character with str_replace("\0", '', $cdata) ? CDATA is raw data and why it doesnt get magically encoded. If you remove the charac

Re: [PHP] Objects as array key names??

2008-03-16 Thread Jim Lucas
Robert Cummings wrote: On Sun, 2008-03-16 at 11:42 -0700, Jim Lucas wrote: Robert Cummings wrote: Imagine 200 customers in your example... your example will hit the DB 201 times. The above hits the DB twice. My code was intended to get the concept across. Thanks for the suggestions though.

Re: [PHP] Objects as array key names??

2008-03-16 Thread Robert Cummings
On Sun, 2008-03-16 at 11:42 -0700, Jim Lucas wrote: > Robert Cummings wrote: > > Imagine 200 customers in your example... your example will hit the DB > > 201 times. The above hits the DB twice. > > My code was intended to get the concept across. Thanks for the > suggestions though. Ah, ok. I'

Re: [PHP] DOM - Question about \0

2008-03-16 Thread Casey
On Sun, Mar 16, 2008 at 1:50 AM, dav <[EMAIL PROTECTED]> wrote: > Hi, > > I have question about \0 character with DOM : > >$cdata = 'foo' . "\0" . 'bar'; > > $dom = new DOMDocument('1.0', 'utf-8'); > $dom->formatOutput = true; > > $container = $dom->createElement('root'); > $blob =

[PHP] Re: Newbie ' If Statement' Question

2008-03-16 Thread Al
Here's how I'd do it. getRecordId();//Or, you can put this inside the heredoc with {} //heredoc $str= << txt; if (!empty($emp_row->getField('testfield')) print $str; else print "Non Print"; ?> [EMAIL PROTECTED] wrote: Hello Folks, I would like to be able to wrap a 'form' inside a php '

Re: [PHP] Objects as array key names??

2008-03-16 Thread Jim Lucas
Richard Heyes wrote: Hi, Going off the subject alone, you might want to investigate the __tostring() magic method that you can define to handle objects being cast to a string. Also, there's a whole bunch of magic methods that you can use to handle PHP operations on user defined objects: htt

Re: [PHP] Objects as array key names??

2008-03-16 Thread Jim Lucas
Robert Cummings wrote: Imagine 200 customers in your example... your example will hit the DB 201 times. The above hits the DB twice. My code was intended to get the concept across. Thanks for the suggestions though. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Newbie ' If Statement' Question

2008-03-16 Thread [EMAIL PROTECTED]
Thank you everybody for these great tips! -- Thanks - RevDave Cool7 @ hosting4days . com [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Objects as array key names??

2008-03-16 Thread Nathan Nobbe
after talking w/ marcus it sounds like theyve explicitly decided not to support objects in the aforementioned context. -nathan

Re: [PHP] Objects as array key names??

2008-03-16 Thread Nathan Nobbe
On Sat, Mar 15, 2008 at 6:02 PM, Jim Lucas <[EMAIL PROTECTED]> wrote: > It has been brought to my attention that with Perl and Ruby, you can use > Objects as the value of the key within an array. The examples that were > shown to me make me think that this would be an awesome ability to have > wi

Re: [PHP] Objects as array key names??

2008-03-16 Thread Richard Heyes
Hi, Going off the subject alone, you might want to investigate the __tostring() magic method that you can define to handle objects being cast to a string. Also, there's a whole bunch of magic methods that you can use to handle PHP operations on user defined objects: http://uk.php.net/manual/

[PHP] DOM - Question about \0

2008-03-16 Thread dav
Hi, I have question about \0 character with DOM : formatOutput = true; $container = $dom->createElement('root'); $blob = $dom->createElement('blob'); $blob->appendChild($dom->createCDATASection($cdata)); $container->appendChild($blob); $dom->appendChild(