php-general Digest 4 Dec 2008 07:36:37 -0000 Issue 5825
php-general Digest 4 Dec 2008 07:36:37 - Issue 5825 Topics (messages 284064 through 284080): Re: adding key- value pair to an array 284064 by: Yeti 284065 by: Jencisson Tsu $_POST suddenly empty; $_GET and _$REQUEST fine 284066 by: Alex Kirk 284067 by: Nathan Rixham 284068 by: Wolf 284069 by: ceo.l-i-e.com 284070 by: Jim Lucas 284071 by: Chris 284072 by: Alex Kirk 284073 by: Chris 284074 by: Nathan Rixham 284075 by: Daniel P. Brown 284076 by: Alex Kirk 284077 by: Alex Kirk 284078 by: Alex Kirk Re: [RESOLVED] Re: $_POST suddenly empty; $_GET and _$REQUEST fine 284079 by: Alex Kirk Re: Short circuit evaluation and include 284080 by: David Ansermot Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- //you can get really stupid with this.. ${false} = 'some string here'; echo ${''}; //echos some string here I like stupid things ---End Message--- ---BeginMessage--- haha,is funny, i like it. Date: Wed, 3 Dec 2008 12:40:39 -0800 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] adding key- value pair to an array //you can get really stupid with this.. ${false} = 'some string here'; echo ${''}; //echos some string here I like stupid things -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ You live life online. So we put Windows on the web. http://clk.atdmt.com/MRT/go/127032869/direct/01/---End Message--- ---BeginMessage--- I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD 6.2. It's worked quite well for over a year now. However, as of some time last night, phpBB broke; upon investigation, I realized that the problem was that $_POST was never getting populated, even on properly formed HTML forms. Testing this to try to find the issue, I used the following script: ?php print Testvar: . $_POST['testvar'] . br/\n; ? form method=POST action=http://www.newmars.com/test.php name=formname enctype=multipart/form-data input type=text name=testvarbr/ input type=submit value=Submitbr/ /form It works like a charm on a different machine with an essentially identical config (it's a newer version of FreeBSD, but that's about it); however, it never displays the contents of $_POST['testvar'] on the machine that suddenly quit functioning right last night. Meanwhile, the rest of PHP seems to be working fine, as the phpBB forum is accessible in a read-only fashion. I've searched all over, and done things like restarting Apache; checking phpinfo() for the POST data (it's not there on the broken server, but it is on the functional one); writting a quick Perl script that took POST input to verify that my browser was sending such data properly (it is); and scouring the Apache/PHP error logs. The worst part is, I didn't touch the config at all between when it worked and when it didn't. So now I'm at a total loss as to what could be causing this, or how I should go about troubleshooting. Any thoughts on this would be greatly appreciated. Alex Kirk This message was sent using IMP, the Internet Messaging Program. ---End Message--- ---BeginMessage--- Alex Kirk wrote: I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD 6.2. It's worked quite well for over a year now. However, as of some time last night, phpBB broke; upon investigation, I realized that the problem was that $_POST was never getting populated, even on properly formed HTML forms. Testing this to try to find the issue, I used the following script: ?php print Testvar: . $_POST['testvar'] . br/\n; ? form method=POST action=http://www.newmars.com/test.php name=formname enctype=multipart/form-data input type=text name=testvarbr/ input type=submit value=Submitbr/ /form looks like you already fixed it.. works fine for me on your server: array(1) { [testvar]= string(2) er } NULL (then all the phpinfo()) i posted er on the form at bottom.. ---End Message--- ---BeginMessage--- -Original Message- From: Alex Kirk I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD 6.2. It's worked quite well for over a year now. However, as of some time last night, phpBB broke; upon investigation, I realized that the problem was that $_POST was never getting populated, even on properly formed HTML forms. Testing this to try to find the issue, I used the following script: ?php print Testvar: .
Re: [PHP] Accessing the 'media' attribute in php
I have enough trouble getting my rather ancient brain around PHP, and was hoping that I could avoid getting involved with JavaScript. However it seems that it, or CSS, are the only possibilities for this case. If I understood you correctly what you want is to change the style of the page when the user is printing it. As others mentioned before all you would have to do would be adding a second style sheet for that purpose. EXAMPLE: link rel=stylesheet media=screen href=/styles/main.css type=text/css / link rel=stylesheet media=print href=/styles/print.css type=text/css / That would be all. Now if you want the user to have some kind of preview when clickin on a print the page button or link you need either JavaScript or PHP. The easiest way I could think of would be using the same print style sheet. For JavaScript have a look at this page ... http://www.quirksmode.org/dom/changess.html I think it should work in most modern browsers. Still doing it with PHP will work in every browser, but requires the page to reload ... For PHP have a look at this page ... http://www.maratz.com/blog/archives/2004/09/21/10-minutes-to-printer-friendly-page/#printQuery //A yeti -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imap4 search criterias
Hello, I have a Fedora Core 9 system with php 5.2.5 and imap enabled. A little program that uses imap_search results in this error. Does the current php version support imap4 search criterias ? Thanks for your help. Here is the little program : ?php $mbox = imap_open({192.6.10.1:143/service=imap}INBOX, [EMAIL PROTECTED], ***, CL_EXPUNGE) or die(can't connect: . imap_last_error()); $MC = imap_check($mbox); $searchResults = imap_search($mbox, SENTSINCE \02 Dec 2008\, SE_UID) ; if(!empty($searchResults)) { echo Not Emptybr/ ; $concatResults = implode(,, $searchResults); // Fetch an overview for all messages in INBOX $result = imap_fetch_overview($mbox,$concatResults, SE_NOPREFETCH+SE_UID); foreach ($result as $overview) { echo #{$overview-msgno} ({$overview-date}) - From: {$overview-from} {$overview-subject}br /\n; } } else { echo Empty . imap_last_error() ; } imap_close($mbox); ? Here is the result : Unknown search criterion: SENTSINCE -- Ergün Koray bb, vm, mu, xg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SELECT into array of arrays
How should I proceed? Thanks in advance for any suggestions. Since you are looping through the result already, why not do it this way .. $combinedArray = array(); for ($i=0;$icount($myArray);$i++) { $sql = SELECT study,symbol FROM test WHERE study IN ('$myArray[$i]'); $result = mysql_query($sql); if(mysql_num_rows($result) 0) { while ($myrow = mysql_fetch_array($result)) { if (in_array($myrow['study'], $myArray)) $combinedArray[$myrow['study']][] = $myrow['symbol']; } } } You should get an array like this ... array(b2008 = array(A, B, C, D), b2005 = array(A, B, E)) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing the 'media' attribute in php
On Wed, 2008-12-03 at 08:00 +0100, Maciek Sokolewicz wrote: Clancy wrote: Oh? Unfortunately I have had great difficulty trying to find out how things really work, as all the books I have seen are recipe books, which tell you how to achieve particular results, but not what is going on behind the scenes. I had assumed that when you hit the 'print' button the browser sent a new request to the server, with a different set of parameters, but I gather from your reply that the browser issues the new (printer) page without reference to the server. Is this what actually happens? If so I fear I will have to work out how to achieve the results I want with CSS styles. It would have been far simpler if I could have done it in php. Thank you for your help. On Wed, 3 Dec 2008 14:34:20 +1300, [EMAIL PROTECTED] (German Geek) wrote: PHP is a server side language... On Wed, Dec 3, 2008 at 2:16 PM, Clancy [EMAIL PROTECTED] wrote: Is it possible to access the 'media' attribute from php, so (for example) you can tailor a page for printing? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Rule #1 on this list: don't top post. That is how it works indeed, you request the page, the server runs the php script, collects the output and sends it to the browser. You view the page in the browser, press print, the browser sends the page data to the printer spooler which sends it to the printer. No PHP involved after it was sent from the server back to the browser. You basically have 2 options now: 1. change the looks trough a different stylesheet (the pretty option) 2. add a print button/link on your page which, when clicked, will redirect to a new page in print format. Then use the javascript print function to call up the browser's print dialog. As for books, most PHP books aren't recipe books, so you've been looking at the wrong ones :) I can recommend O'Reilly's books, they're pretty good. Especially Programming PHP [1]. But that's just my general liking of those books ;) - Tul [1] http://oreilly.com/catalog/9780596006815/ Go with what Yeti said. The browser will automatically pick the right stylesheet when the user presses the print button or you issue a window.print() from Javascript. Whatever you do, don't have a separate page for print view. This is one of those things that some bright spark thought to do on a site at work, and the site in question was already a couple hundred HTML pages, so he effectively doubled that figure. It makes your work harder in the long run if you need to update it at any time, and with the media=print attribute set for the extra stylesheet, it's automatically selected anyways. On an aside, Opera has a neat option that lets you select from all the stylesheets a page has available, which will make it easier when you're developing the stylesheet rather than having to keep clicking print preview in your browser! Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SELECT into array of arrays
Correcting myself now .. $myArray = array('b2005', 'b2008'); $sql = SELECT study,symbol FROM test WHERE study IN ('$myArray[$i]'); $result = mysql_query($sql); if(mysql_num_rows($result) 0) { while ($myrow = mysql_fetch_array($result)) { if (in_array($myrow['study'], $myArray)) $combinedArray[$myrow['study']][] = $myrow['symbol']; } } Forgot to get rid of the first for loop -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Objects and Arrays Conversion
On Tue, Dec 2, 2008 at 7:48 PM, Micah Gersten [EMAIL PROTECTED] wrote: VamVan wrote: Hello All, I was stuck with this issue. So just felt the need to reach out to other strugglers. May be people might enjoy this: Here is the code for object to array and array to object conversion: function object_2_array($data) { if(is_array($data) || is_object($data)) { $result = array(); foreach ($data as $key = $value) { $result[$key] = object_2_array($value); } return $result; } return $data; } function array_2_object($array) { $object = new stdClass(); if (is_array($array) count($array) 0) { foreach ($array as $name=$value) { $name = strtolower(trim($name)); if (!empty($name)) { $object-$name = $value; } } } return $object; } have fun ! Thanks ... As for the object to array, the same thing applies: http://us2.php.net/manual/en/language.types.array.php $array = (array) $object; not quite, take a look at VamVan's object_2_array(), its recursive. a simple type-cast will only alter the outermost layer of the $object in your example above. im not sure, but im assuming VamVan may have meant to make array_2_object() recursive as well ?? that would be more consistent anyway imo.. heres a simple script to illustrate the shallow nature of type-casting ?php $arr = array( 'b' = array( 'c' = array( 'd' ) ) ); $obj = new stdClass(); $obj-b = new stdClass(); $obj-b-c = new stdClass(); $obj-b-c-d = new stdClass(); var_dump((array)$obj); var_dump((object)$arr); ? results in phdelnnobbe:~ nnobbe$ php arrayToObject.php array(1) { [b]= object(stdClass)#2 (1) { [c]= object(stdClass)#3 (1) { [d]= object(stdClass)#4 (0) { } } } } object(stdClass)#5 (1) { [b]= array(1) { [c]= array(1) { [0]= string(1) d } } } Not sure if these are PHP 5 only or not. the manual should say. -nathan
[PHP] adding key- value pair to an array
Hi all, Can anybody tell me how can I add key-value pair in an array. My code is as follows $criteria = array(); $criteria['mail_subject'] = $form-subject-getValue(); $criteria['delivery_user_name'] = $form-delivery_user_name-getValue(); $criteria['start_date'] = $form-start_date-getValue(); $criteria['end_date'] = $form-end_date-getValue(); $criteria['group'] = $form-group-getValue(); // get table data from database $rowset = $mailDelivery-findDeliveryMailData($criteria); //convert rowset into an array $mailDataArray = $rowset-toArray(); if(count($mailDataArray) != 0){ foreach($mailDataArray as $row){ $condition['mail_delivery_id'] = $row-id; $browseCount = $mailDeliveryDetail-findBrowseCount($condition); $totalCount = $mailDeliveryDetail-findTotalCount($condition); //for each row I want to add percentage as new key-value pair // but it gives error 'Undefined variable: percentage' $row-$percentage = ($browseCount / $totalCount ) * 100; } } Please somebody tell me how to achieve this. Thanks in advance. Aniket -- View this message in context: http://www.nabble.com/adding-key-%3E-value-pair-to-an-array-tp20809114p20809114.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] adding key- value pair to an array
Hi all, Can anybody tell me how can I add key-value pair in an array. My code is as follows $criteria = array(); $criteria['mail_subject'] = $form-subject-getValue(); $criteria['delivery_user_name'] = $form-delivery_user_name-getValue(); $criteria['start_date'] = $form-start_date-getValue(); $criteria['end_date'] = $form-end_date-getValue(); $criteria['group'] = $form-group-getValue(); // get table data from database $rowset = $mailDelivery-findDeliveryMailData($criteria); //convert rowset into an array $mailDataArray = $rowset-toArray(); if(count($mailDataArray) != 0){ foreach($mailDataArray as $row){ $condition['mail_delivery_id'] = $row-id; $browseCount = $mailDeliveryDetail-findBrowseCount($condition); $totalCount = $mailDeliveryDetail-findTotalCount($condition); //for each row I want to add percentage as new key-value pair // but it gives error 'Undefined variable: percentage' $row-$percentage = ($browseCount / $totalCount ) * 100; } } Please somebody tell me how to achieve this. Thanks in advance. Aniket -- View this message in context: http://www.nabble.com/adding-key-%3E-value-pair-to-an-array-tp20809115p20809115.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing the 'media' attribute in php
On Wed, 03 Dec 2008 08:15:14 +, [EMAIL PROTECTED] (Ashley Sheridan) wrote: Go with what Yeti said. The browser will automatically pick the right stylesheet when the user presses the print button or you issue a window.print() from Javascript. Whatever you do, don't have a separate page for print view. This is one of those things that some bright spark thought to do on a site at work, and the site in question was already a couple hundred HTML pages, so he effectively doubled that figure. It makes your work harder in the long run if you need to update it at any time, and with the media=print attribute set for the extra stylesheet, it's automatically selected anyways. On an aside, Opera has a neat option that lets you select from all the stylesheets a page has available, which will make it easier when you're developing the stylesheet rather than having to keep clicking print preview in your browser! Thank you to everyone who has replied on this. While there are reasonably good books on the individual tools (PHP, JavaScript, etc) very few go into how they all interact, and this was the subject of my confusion. Maciek's succinct description has made it clear why my original request could never be implemented, so I will have to use CSS to achieve the results I want. This is not THAT bad, but CSS was clearly not designed by a programmer, and to my mind seems to have a very convoluted logic, so I prefer to avoid using it if I can. And thank you for the tip about Opera. That feature sounds as if it could be very useful! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] adding key- value pair to an array
//for each row I want to add percentage as new key-value pair // but it gives error 'Undefined variable: percentage' $row-$percentage = ($browseCount / $totalCount ) * 100; Obviously you get the error because $percentage is not defined .. I did not fully understand what you wanted. Here is a list of what should work ... #Set a variable percentage in $row $row-percentage = ($browseCount / $totalCount ) * 100; #Set a variable with name $percentage in $row $percentage = ($browseCount / $totalCount ) * 100; $row-$percentage = $percentage; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Accessing the 'media' attribute in php
'Twas brillig, and Ashley Sheridan at 03/12/08 08:15 did gyre and gimble: Whatever you do, don't have a separate page for print view. This is one of those things that some bright spark thought to do on a site at work, and the site in question was already a couple hundred HTML pages, so he effectively doubled that figure. It makes your work harder in the long run if you need to update it at any time, and with the media=print attribute set for the extra stylesheet, it's automatically selected anyways. While I don't want to disagree with the print media option (it's my preferred route), depending on your application/use case etc, having a separate print layout could make sense. Say you have a content management system that displays an entry over several small pages. If you want to print out details of that entry it may make sense to combine the salient details from all the mini-pages into one printable page. If your application is designed well, then this approach certainly doesn't double your number of pages (from a maintenance perspective). If you have a 1000 entries each with 5 mini-pages and you add a print version you are changing the number from 5 to 6, not 5000 to 6000. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap4 search criterias
I have a Fedora Core 9 system with php 5.2.5 and imap enabled. A little program that uses imap_search results in this error. Does the current php version support imap4 search criterias ? It does, and has done for a while. I used it my Vwebmail application (which I no longer have I'm afraid). But try the manual: http://uk2.php.net/imap_search -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 29th) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Picture downloading in IE
Hi, I have a strange error / misfunction with PHP header and IE7. I render a JPG from a database BLOB to show it on a page. In Firefox, when the user clicks on the image, and selects Save image as... , (s)he can download it in JPG format. But when a user in IE7 does the same, (s)he only can getit in BMP. The header I sent is the same both case: header('Content-Type: image/pjpeg'); I tried to set Content-Disposition to inline or attachment, set filename to different values, but get the same result. Now all I can say is HEELP :) Thanks, SanTa
Re: [PHP] Accessing the 'media' attribute in php
A couple of sites about making CSS print stylesheets. http://www.alistapart.com/articles/goingtoprint/ http://www.webdesignschoolreview.com/css-printing.html I'd send you links to more, but my Internet connection is shaped, and it's too slow to look through many more. Michael Kubler *G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz Clancy wrote: On Wed, 3 Dec 2008 15:28:17 +1300, [EMAIL PROTECTED] (German Geek) wrote: You can do things on the client side with Javascript ;) Sorry, what was the result you are after? I have enough trouble getting my rather ancient brain around PHP, and was hoping that I could avoid getting involved with JavaScript. However it seems that it, or CSS, are the only possibilities for this case. Bother!
Re: [PHP] Picture downloading in IE
I don't think, because it happens on different machines, with different users. (one of them is a fresh install) SanTa - Original Message - From: Ramesh Thiruchelvam To: Sándor Tamás (HostWare Kft. ) Sent: Wednesday, December 03, 2008 12:05 PM Subject: Re: [PHP] Picture downloading in IE Hi Santa, It seems to be a problem in IE when damaged activex or a java object is in the cache. Try clearing your temporary internet files and see. http://support.microsoft.com/kb/810978 Kr, Ramesh On Wed, Dec 3, 2008 at 4:20 PM, Sándor Tamás (HostWare Kft. ) [EMAIL PROTECTED] wrote: Hi, I have a strange error / misfunction with PHP header and IE7. I render a JPG from a database BLOB to show it on a page. In Firefox, when the user clicks on the image, and selects Save image as... , (s)he can download it in JPG format. But when a user in IE7 does the same, (s)he only can getit in BMP. The header I sent is the same both case: header('Content-Type: image/pjpeg'); I tried to set Content-Disposition to inline or attachment, set filename to different values, but get the same result. Now all I can say is HEELP :) Thanks, SanTa
Re: [PHP] Picture downloading in IE
I've seen this issue on a normally healthy machine. I think it's a memory issue, or IE just corrupting itself sometimes. I don't change anything and it seems to go away (probably fresh browser session) Although I am sure invalid/confusing headers won't help. On Wed, Dec 3, 2008 at 3:08 AM, Sándor Tamás (HostWare Kft. ) [EMAIL PROTECTED] wrote: I don't think, because it happens on different machines, with different users. (one of them is a fresh install) SanTa - Original Message - From: Ramesh Thiruchelvam To: Sándor Tamás (HostWare Kft. ) Sent: Wednesday, December 03, 2008 12:05 PM Subject: Re: [PHP] Picture downloading in IE Hi Santa, It seems to be a problem in IE when damaged activex or a java object is in the cache. Try clearing your temporary internet files and see. http://support.microsoft.com/kb/810978 Kr, Ramesh On Wed, Dec 3, 2008 at 4:20 PM, Sándor Tamás (HostWare Kft. ) [EMAIL PROTECTED] wrote: Hi, I have a strange error / misfunction with PHP header and IE7. I render a JPG from a database BLOB to show it on a page. In Firefox, when the user clicks on the image, and selects Save image as... , (s)he can download it in JPG format. But when a user in IE7 does the same, (s)he only can getit in BMP. The header I sent is the same both case: header('Content-Type: image/pjpeg'); I tried to set Content-Disposition to inline or attachment, set filename to different values, but get the same result. Now all I can say is HEELP :) Thanks, SanTa
Re: [PHP] imap4 search criterias
Thanks for the quick reply, There is no SENTSINCE keyword in the critera parameter section, so I believe that no SENTSINCE queries can be performed againts the server. The problem with the SINCE keyword is that it returns the wrong results. On Wed, Dec 3, 2008 at 12:07 PM, Richard Heyes [EMAIL PROTECTED] wrote: I have a Fedora Core 9 system with php 5.2.5 and imap enabled. A little program that uses imap_search results in this error. Does the current php version support imap4 search criterias ? It does, and has done for a while. I used it my Vwebmail application (which I no longer have I'm afraid). But try the manual: http://uk2.php.net/imap_search -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 29th) -- Ergün Koray bb, vm, mu, xg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing the 'media' attribute in php
but I gather from your reply that the browser issues the new (printer) page without reference to the server. Is this what actually happens? Yes, this is what actually happens for the browser print button. You could do something like a Printer Friendly button to generate a PDF on the fly or somesuch, and POST back all the data you need to generate a nice PDF of the page. Example: http://l-i-e.com/resume.htm (Source code link at the bottom of the page) Reference material: http://php.net/libpdf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to type arguments
I'm surprised nobody mentioned: http://php.net/assert in this thread yet. Perhaps I missed it? You should really consider doing this: 1) At the outer API layer, do a typecast (possibly with preg_match first) to convert the input data to acceptable form. 2) For inner API layer[s], sprinkle assert calls as needed to make sure during dev/testing that the outer layer is doing it right. In PROD, the assert can turn into a no-op, with no performance penalty, as I understand it. Disclosure: I've never worked on a project organized enough to actually do this properly. Sigh. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SELECT into array of arrays
Thanks Yeti, it works. Best, Andrej Yeti wrote: Correcting myself now .. $myArray = array('b2005', 'b2008'); $sql = SELECT study,symbol FROM test WHERE study IN ('$myArray[$i]'); $result = mysql_query($sql); if(mysql_num_rows($result) 0) { while ($myrow = mysql_fetch_array($result)) { if (in_array($myrow['study'], $myArray)) $combinedArray[$myrow['study']][] = $myrow['symbol']; } } Forgot to get rid of the first for loop -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap4 search criterias
As I recall, there needs to be a \SENTSINCE instead of just SENTSINCE, and the PHP online manual ended up stripping out the \ business... Or maybe that was in some kind of flags somewhere else... Check the user contributed notes -- Those are invaluable for what can go wrong type of insight. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SELECT into array of arrays
I actually would do more like: $myArray[$study][$symbol] = true; No need to call in_array. Probably won't matter, really, but it's a good practice for when you end up doing the same kind of code for an array with thousands of elements. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SELECT into array of arrays
And yet another thing i have overseen in my statement .. If you remove the first for loop, also change the sql query. But I'm sure you saw that already NEW QUERY: $sql = SELECT study,symbol FROM test WHERE study IN ('.implode(', ', $myArray).'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] adding key- value pair to an array
Yeti wrote: //for each row I want to add percentage as new key-value pair // but it gives error 'Undefined variable: percentage' $row-$percentage = ($browseCount / $totalCount ) * 100; Obviously you get the error because $percentage is not defined .. I did not fully understand what you wanted. Here is a list of what should work ... #Set a variable percentage in $row $row-percentage = ($browseCount / $totalCount ) * 100; #Set a variable with name $percentage in $row $percentage = ($browseCount / $totalCount ) * 100; $row-$percentage = $percentage; I don't think the above will work either, afaik php doesn't allow you to have variable names start with numbers. Also, there is a high possibility that $percentage would end up being a float. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] adding key- value pair to an array
Aniketto wrote: Hi all, Can anybody tell me how can I add key-value pair in an array. My code is as follows $criteria = array(); $criteria['mail_subject'] = $form-subject-getValue(); $criteria['delivery_user_name'] = $form-delivery_user_name-getValue(); $criteria['start_date'] = $form-start_date-getValue(); $criteria['end_date'] = $form-end_date-getValue(); $criteria['group'] = $form-group-getValue(); // get table data from database $rowset = $mailDelivery-findDeliveryMailData($criteria); //convert rowset into an array $mailDataArray = $rowset-toArray(); if you do a print_r() right here on $mailDataArray, what does it look like? if(count($mailDataArray) != 0){ foreach($mailDataArray as $row){ $condition['mail_delivery_id'] = $row-id; $browseCount = $mailDeliveryDetail-findBrowseCount($condition); $totalCount = $mailDeliveryDetail-findTotalCount($condition); //for each row I want to add percentage as new key-value pair // but it gives error 'Undefined variable: percentage' $row-$percentage = ($browseCount / $totalCount ) * 100; Were you intending to just say $row-percentage instead of calling $percentage? } } Please somebody tell me how to achieve this. Thanks in advance. Aniket -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] adding key- value pair to an array
Jim Lucas wrote: I don't think the above will work either, afaik php doesn't allow you to have variable names start with numbers. well debatable.. # $12 = 'value'; Parsing Error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' # $varname = 12; $$varname = 'sentence'; echo $$varname; //echos sentence # ${12} = 'some string here'; echo ${12}; //echos some string here //you can get really stupid with this.. ${false} = 'some string here'; echo ${''}; //echos some string here -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] adding key- value pair to an array
//you can get really stupid with this.. ${false} = 'some string here'; echo ${''}; //echos some string here I like stupid things -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] adding key- value pair to an array
haha,is funny, i like it. Date: Wed, 3 Dec 2008 12:40:39 -0800 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; php-general@lists.php.net Subject: Re: [PHP] adding key- value pair to an array //you can get really stupid with this.. ${false} = 'some string here'; echo ${''}; //echos some string here I like stupid things -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ You live life online. So we put Windows on the web. http://clk.atdmt.com/MRT/go/127032869/direct/01/
[PHP] $_POST suddenly empty; $_GET and _$REQUEST fine
I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD 6.2. It's worked quite well for over a year now. However, as of some time last night, phpBB broke; upon investigation, I realized that the problem was that $_POST was never getting populated, even on properly formed HTML forms. Testing this to try to find the issue, I used the following script: ?php print Testvar: . $_POST['testvar'] . br/\n; ? form method=POST action=http://www.newmars.com/test.php name=formname enctype=multipart/form-data input type=text name=testvarbr/ input type=submit value=Submitbr/ /form It works like a charm on a different machine with an essentially identical config (it's a newer version of FreeBSD, but that's about it); however, it never displays the contents of $_POST['testvar'] on the machine that suddenly quit functioning right last night. Meanwhile, the rest of PHP seems to be working fine, as the phpBB forum is accessible in a read-only fashion. I've searched all over, and done things like restarting Apache; checking phpinfo() for the POST data (it's not there on the broken server, but it is on the functional one); writting a quick Perl script that took POST input to verify that my browser was sending such data properly (it is); and scouring the Apache/PHP error logs. The worst part is, I didn't touch the config at all between when it worked and when it didn't. So now I'm at a total loss as to what could be causing this, or how I should go about troubleshooting. Any thoughts on this would be greatly appreciated. Alex Kirk This message was sent using IMP, the Internet Messaging Program. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $_POST suddenly empty; $_GET and _$REQUEST fine
Alex Kirk wrote: I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD 6.2. It's worked quite well for over a year now. However, as of some time last night, phpBB broke; upon investigation, I realized that the problem was that $_POST was never getting populated, even on properly formed HTML forms. Testing this to try to find the issue, I used the following script: ?php print Testvar: . $_POST['testvar'] . br/\n; ? form method=POST action=http://www.newmars.com/test.php name=formname enctype=multipart/form-data input type=text name=testvarbr/ input type=submit value=Submitbr/ /form looks like you already fixed it.. works fine for me on your server: array(1) { [testvar]= string(2) er } NULL (then all the phpinfo()) i posted er on the form at bottom.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_POST suddenly empty; $_GET and _$REQUEST fine
-Original Message- From: Alex Kirk I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD 6.2. It's worked quite well for over a year now. However, as of some time last night, phpBB broke; upon investigation, I realized that the problem was that $_POST was never getting populated, even on properly formed HTML forms. Testing this to try to find the issue, I used the following script: ?php print Testvar: . $_POST['testvar'] . br/\n; ? form method=POST action=http://www.newmars.com/test.php name=formname enctype=multipart/form-data input type=text name=testvarbr/ input type=submit value=Submitbr/ /form It works like a charm on a different machine with an essentially identical config (it's a newer version of FreeBSD, but that's about it); however, it never displays the contents of $_POST['testvar'] on the machine that suddenly quit functioning right last night. Meanwhile, the rest of PHP seems to be working fine, as the phpBB forum is accessible in a read-only fashion. I've searched all over, and done things like restarting Apache; checking phpinfo() for the POST data (it's not there on the broken server, but it is on the functional one); writting a quick Perl script that took POST input to verify that my browser was sending such data properly (it is); and scouring the Apache/PHP error logs. The worst part is, I didn't touch the config at all between when it worked and when it didn't. So now I'm at a total loss as to what could be causing this, or how I should go about troubleshooting... == Did you check the apache logs or the php error logs? How about disk space on the server location where it is storing it's temp files for the server? I've seen something similar when disk space was nil after some scripts ran amok. HTH, Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST suddenly empty; $_GET and _$REQUEST fine
There are httpd.conf settings to reject POST requests, but I don't think it would behave like that... But maybe it's a bit more complicated than what I've ever seen for httpd.conf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_POST suddenly empty; $_GET and _$REQUEST fine
Nathan Rixham wrote: Alex Kirk wrote: I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD 6.2. It's worked quite well for over a year now. However, as of some time last night, phpBB broke; upon investigation, I realized that the problem was that $_POST was never getting populated, even on properly formed HTML forms. Testing this to try to find the issue, I used the following script: ?php print Testvar: . $_POST['testvar'] . br/\n; ? form method=POST action=http://www.newmars.com/test.php name=formname enctype=multipart/form-data input type=text name=testvarbr/ input type=submit value=Submitbr/ /form looks like you already fixed it.. works fine for me on your server: array(1) { [testvar]= string(2) er } NULL (then all the phpinfo()) i posted er on the form at bottom.. Seems to be working for me also. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST suddenly empty; $_GET and _$REQUEST fine
[EMAIL PROTECTED] wrote: There are httpd.conf settings to reject POST requests, but I don't think it would behave like that... But maybe it's a bit more complicated than what I've ever seen for httpd.conf Could be mod_security getting in the way and killing some content. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_POST suddenly empty; $_GET and _$REQUEST fine
I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD 6.2. It's worked quite well for over a year now. However, as of some time last night, phpBB broke; upon investigation, I realized that the problem was that $_POST was never getting populated, even on properly formed HTML forms. Testing this to try to find the issue, I used the following script: ?php print Testvar: . $_POST['testvar'] . br/\n; ? form method=POST action=http://www.newmars.com/test.php name=formname enctype=multipart/form-data input type=text name=testvarbr/ input type=submit value=Submitbr/ /form looks like you already fixed it.. works fine for me on your server: array(1) { [testvar]= string(2) er } NULL (then all the phpinfo()) i posted er on the form at bottom.. Seems to be working for me also. I wish it were a real fix. I had switched the print statement back to use $_REQUEST after I pasted the code in my message, just to be 100% certain that I wasn't losing it, and didn't think to switch it back before I left work for the evening - somehow I didn't anticipate you guys actually using the live form. :-P Did you check the apache logs or the php error logs? Apache logs show no errors at all. The PHP error log is more interesting - I turned on logging to /var/log/php.err once I started trying to diagnose this, and that file has yet to be created. At one point today, I intentionally wrote in a syntax error to a PHP script, and the error message printed out into the Apache log, so at this point I'm assuming that if PHP were going to give me a relevant error, it'd be there. How about disk space on the server location where it is storing it's temp files for the server? I've seen something similar when disk space was nil after some scripts ran amok. Temp files should be on /, which is only at 41% of capacity. Even if it's /usr, that's at 90%, not 100%. Alex This message was sent using IMP, the Internet Messaging Program. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_POST suddenly empty; $_GET and _$REQUEST fine
Did you check the apache logs or the php error logs? Apache logs show no errors at all. The PHP error log is more interesting - I turned on logging to /var/log/php.err once I started trying to diagnose this, and that file has yet to be created. Apache can't write to that location. You need to create it and chown it. touch /var/log/php.err chown apache:apache /var/log/php.err adjust apache with your webserver user/group (check httpd.conf) though I doubt anything will show up there. Do you have mod_security enabled in apache? Maybe it's catching something it shouldn't. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_POST suddenly empty; $_GET and _$REQUEST fine
Alex Kirk wrote: I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD 6.2. It's worked quite well for over a year now. However, as of some time last night, phpBB broke; upon investigation, I realized that the problem was that $_POST was never getting populated, even on properly formed HTML forms. Testing this to try to find the issue, I used the following script: ?php print Testvar: . $_POST['testvar'] . br/\n; ? form method=POST action=http://www.newmars.com/test.php name=formname enctype=multipart/form-data input type=text name=testvarbr/ input type=submit value=Submitbr/ /form looks like you already fixed it.. works fine for me on your server: array(1) { [testvar]= string(2) er } NULL (then all the phpinfo()) i posted er on the form at bottom.. Seems to be working for me also. I wish it were a real fix. I had switched the print statement back to use $_REQUEST after I pasted the code in my message, just to be 100% certain that I wasn't losing it, and didn't think to switch it back before I left work for the evening - somehow I didn't anticipate you guys actually using the live form. :-P Did you check the apache logs or the php error logs? Apache logs show no errors at all. The PHP error log is more interesting - I turned on logging to /var/log/php.err once I started trying to diagnose this, and that file has yet to be created. At one point today, I intentionally wrote in a syntax error to a PHP script, and the error message printed out into the Apache log, so at this point I'm assuming that if PHP were going to give me a relevant error, it'd be there. How about disk space on the server location where it is storing it's temp files for the server? I've seen something similar when disk space was nil after some scripts ran amok. Temp files should be on /, which is only at 41% of capacity. Even if it's /usr, that's at 90%, not 100%. Alex This message was sent using IMP, the Internet Messaging Program. and if you remove the multipart/form-data from the form? any includes in that script that script? any .htaccess rewrites? error_reporting(E_ALL | E_STRICT) set? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST suddenly empty; $_GET and _$REQUEST fine
On Wed, Dec 3, 2008 at 6:03 PM, Alex Kirk [EMAIL PROTECTED] wrote: It works like a charm on a different machine with an essentially identical config (it's a newer version of FreeBSD, but that's about it); however, it never displays the contents of $_POST['testvar'] on the machine that suddenly quit functioning right last night. Check your php.ini and make sure your EGPCS (variables_order) is okay. -- /Daniel P. Brown http://www.parasane.net/ [EMAIL PROTECTED] || [EMAIL PROTECTED] 50% Off Hosting! http://www.pilotpig.net/specials.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST suddenly empty; $_GET and _$REQUEST fine
Quoting Daniel P. Brown [EMAIL PROTECTED]: On Wed, Dec 3, 2008 at 6:03 PM, Alex Kirk [EMAIL PROTECTED] wrote: It works like a charm on a different machine with an essentially identical config (it's a newer version of FreeBSD, but that's about it); however, it never displays the contents of $_POST['testvar'] on the machine that suddenly quit functioning right last night. Check your php.ini and make sure your EGPCS (variables_order) is okay. It is. In fact, my config is virtually default: [EMAIL PROTECTED] /usr/local/etc]$ diff -u php.ini php.ini-dist --- php.ini Wed Dec 3 16:08:31 2008 +++ php.ini-distTue Jul 22 11:00:49 2008 @@ -328,7 +328,7 @@ ; ; stdout (On) - Display errors to STDOUT ; -;display_errors = On +display_errors = On ; Even when display_errors is on, errors that occur during PHP's startup ; sequence are not displayed. It's strongly recommended to keep @@ -338,7 +338,7 @@ ; Log errors into a log file (server-specific log, stderr, or error_log (below)) ; As stated above, you're strongly advised to use error logging in place of ; error displaying on production web sites. -log_errors = On +log_errors = Off ; Set maximum length of log_errors. In error_log information about the source is ; added. The default is 1024 and 0 allows to not apply any maximum length at all. @@ -384,7 +384,7 @@ ;error_append_string = /font ; Log errors to specified file. -error_log = /var/log/php.err +;error_log = filename ; Log errors to syslog (Event Log on NT, not valid in Windows 95). ;error_log = syslog This message was sent using IMP, the Internet Messaging Program. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_POST suddenly empty; $_GET and _$REQUEST fine
touch /var/log/php.err chown apache:apache /var/log/php.err adjust apache with your webserver user/group (check httpd.conf) though I doubt anything will show up there. Well, done anyway, just in case. Do you have mod_security enabled in apache? Maybe it's catching something it shouldn't. Nope, unless grep -iIR security * in /usr/local/etc/apache22 is lying to me. ;-) Alex This message was sent using IMP, the Internet Messaging Program. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_POST suddenly empty; $_GET and _$REQUEST fine
I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD 6.2. It's worked quite well for over a year now. However, as of some time last night, phpBB broke; upon investigation, I realized that the problem was that $_POST was never getting populated, even on properly formed HTML forms. Testing this to try to find the issue, I used the following script: ?php print Testvar: . $_POST['testvar'] . br/\n; ? form method=POST action=http://www.newmars.com/test.php name=formname enctype=multipart/form-data input type=text name=testvarbr/ input type=submit value=Submitbr/ /form looks like you already fixed it.. works fine for me on your server: array(1) { [testvar]= string(2) er } NULL (then all the phpinfo()) i posted er on the form at bottom.. Seems to be working for me also. I wish it were a real fix. I had switched the print statement back to use $_REQUEST after I pasted the code in my message, just to be 100% certain that I wasn't losing it, and didn't think to switch it back before I left work for the evening - somehow I didn't anticipate you guys actually using the live form. :-P Did you check the apache logs or the php error logs? Apache logs show no errors at all. The PHP error log is more interesting - I turned on logging to /var/log/php.err once I started trying to diagnose this, and that file has yet to be created. At one point today, I intentionally wrote in a syntax error to a PHP script, and the error message printed out into the Apache log, so at this point I'm assuming that if PHP were going to give me a relevant error, it'd be there. How about disk space on the server location where it is storing it's temp files for the server? I've seen something similar when disk space was nil after some scripts ran amok. Temp files should be on /, which is only at 41% of capacity. Even if it's /usr, that's at 90%, not 100%. Alex and if you remove the multipart/form-data from the form? I actually added it in during my testing, since I'd seen some bugs from 2005 or so related to that. I hadn't specified an encoding previously. any includes in that script that script? None. any .htaccess rewrites? Hmmm, that's interesting: this is present in the docroot for www.newmars.com: IfModule mod_rewrite.c RewriteEngine On RewriteBase /wordpress/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wordpress/index.php [L] /IfModule mod_rewrite is indeed enabled in the main HTTP config (we use it on other domains hosted on the box). /wordpress does exist on that virtual host, but I admit, this is one area that I'm not super-well versed on. Are there known issues with POST data and rewrites? It seems sort of odd, since that .htaccess hasn't changed since 3/8/08, but at this point I'll accept just about any solution. :-) error_reporting(E_ALL | E_STRICT) set? It is now...but the whole damn domain went down. WTF This message was sent using IMP, the Internet Messaging Program. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [RESOLVED] Re: $_POST suddenly empty; $_GET and _$REQUEST fine
I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD 6.2. It's worked quite well for over a year now. However, as of some time last night, phpBB broke; upon investigation, I realized that the problem was that $_POST was never getting populated, even on properly formed HTML forms. Testing this to try to find the issue, I used the following script: ?php print Testvar: . $_POST['testvar'] . br/\n; ? form method=POST action=http://www.newmars.com/test.php name=formname enctype=multipart/form-data input type=text name=testvarbr/ input type=submit value=Submitbr/ /form looks like you already fixed it.. works fine for me on your server: array(1) { [testvar]= string(2) er } NULL (then all the phpinfo()) i posted er on the form at bottom.. Seems to be working for me also. I wish it were a real fix. I had switched the print statement back to use $_REQUEST after I pasted the code in my message, just to be 100% certain that I wasn't losing it, and didn't think to switch it back before I left work for the evening - somehow I didn't anticipate you guys actually using the live form. :-P Did you check the apache logs or the php error logs? Apache logs show no errors at all. The PHP error log is more interesting - I turned on logging to /var/log/php.err once I started trying to diagnose this, and that file has yet to be created. At one point today, I intentionally wrote in a syntax error to a PHP script, and the error message printed out into the Apache log, so at this point I'm assuming that if PHP were going to give me a relevant error, it'd be there. How about disk space on the server location where it is storing it's temp files for the server? I've seen something similar when disk space was nil after some scripts ran amok. Temp files should be on /, which is only at 41% of capacity. Even if it's /usr, that's at 90%, not 100%. Alex and if you remove the multipart/form-data from the form? I actually added it in during my testing, since I'd seen some bugs from 2005 or so related to that. I hadn't specified an encoding previously. any includes in that script that script? None. any .htaccess rewrites? Hmmm, that's interesting: this is present in the docroot for www.newmars.com: IfModule mod_rewrite.c RewriteEngine On RewriteBase /wordpress/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wordpress/index.php [L] /IfModule mod_rewrite is indeed enabled in the main HTTP config (we use it on other domains hosted on the box). /wordpress does exist on that virtual host, but I admit, this is one area that I'm not super-well versed on. Are there known issues with POST data and rewrites? It seems sort of odd, since that .htaccess hasn't changed since 3/8/08, but at this point I'll accept just about any solution. :-) error_reporting(E_ALL | E_STRICT) set? It is now...but the whole damn domain went down. WTF OK, so first off, this outage is apparently something confined to the XP laptop I'm currently sitting at. Remind me to go check for spyware after I send this... That said, I was checking with the other guy who has root on the box before I rebooted the whole server, in case it was some bizarre caching issue, and he asked that I remove the following line from httpd.conf before I did so, since apparently he'd added it around the time that PHP had eaten itself: LoadModule python_module libexec/apache22/mod_python.so Strangely enough, after rebooting Apache, it worked like a charm. The only possible explanation that I can think of - since mod_python and libphp5 shouldn't conflict - is that this line was immediately preceded by: LoadModule php5_modulelibexec/apache22/libphp5.so ...and Apache did some sort of dumb parsing thing. Though I guess that wouldn't explain why PHP was only partially broken... So at this point, I'd like to thank all of you for your extremely rapid and thorough responses, and say that if anyone cares to probe this further, I'm open to testing things out...but if we just want to chalk it up to random weirdness, I'm OK with that, too. Alex This message was sent using IMP, the Internet Messaging Program. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Short circuit evaluation and include
include and include_once dont throw fatal exception. You should use require or require_once and catch the exception with try{}catch{} block [EMAIL PROTECTED] a écrit : include and require are not functions. They are language constructs. They probably don't return values nor short-circuit in the usual way. Ditto for echo If you can strip the parens and have it still work, it's for sure not a function. ?php include_once $file; echo $file; ? is perfectly valid code. PS All those disk calls are going to get pretty expensive if your site gets heavy traffic... You may want to just write a custom error_handler and use include_once which will let you trap the error and do something intelligent with it... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php