php-general Digest 10 Aug 2009 11:17:55 -0000 Issue 6277

2009-08-10 Thread php-general-digest-help
php-general Digest 10 Aug 2009 11:17:55 - Issue 6277 Topics (messages 296525 through 296542): Re: PHP programming strategy 296525 by: tedd 296526 by: Eddie Drapkin Re: MySQL auto_increment fields Server version: 5.1.32-community-log 296527 by: Ralph Deffke

RE: [PHP] Radio buttons problem

2009-08-10 Thread leledumbo
Why do you? There's no reason you *have* to have consecutive indexes -- just iterate over the resulting array with foreach, and there's no problem. There is, the entries are grouped by its index. So, I group name[0], email[0], and sex[0] as one. The problem if I don't maintain the index for

Re: [PHP] MySQL auto_increment fields Server version: 5.1.32-community-log

2009-08-10 Thread tedd
At 12:47 AM +0200 8/10/09, Ralph Deffke wrote: I would like to have a KNOWN status of my database after a NEW installation of the application, because the further installation relais on information stored in record 1 of each table. Sounds like a problem waiting to happen. Cheers, tedd --

RE: [PHP] Server change affecting ability to send downloaded files???

2009-08-10 Thread Ford, Mike
-Original Message- From: Brian Dunning [mailto:br...@briandunning.com] Sent: 08 August 2009 01:04 To: PHP General List Subject: Re: [PHP] Server change affecting ability to send downloaded files??? Very interesting. Excellent debugging advice. It's giving me a 500 error,

RE: [PHP] Radio buttons problem

2009-08-10 Thread Ford, Mike
-Original Message- From: leledumbo [mailto:leledumbo_c...@yahoo.co.id] Sent: 10 August 2009 11:11 To: php-general@lists.php.net Subject: RE: [PHP] Radio buttons problem Why do you? There's no reason you *have* to have consecutive indexes -- just iterate over the resulting

[PHP] Array

2009-08-10 Thread Ron Piggott
How do I change this ELSEIF into an array? } elseif ( ( $page ) AND ( $page home_page ) AND ( $page verse_of_the_day_activate ) AND ( $page member_services ) AND ( $page member_services_login ) AND ( $page member_services_logoff ) AND ( $page resource_center ) AND ( $page network ) )

Re: [PHP] Array

2009-08-10 Thread Jonathan Tapicer
On Mon, Aug 10, 2009 at 9:28 AM, Ron Piggottron.pigg...@actsministries.org wrote: How do I change this ELSEIF into an array? } elseif ( ( $page ) AND ( $page home_page ) AND ( $page verse_of_the_day_activate ) AND ( $page member_services ) AND ( $page member_services_login ) AND (

Re: [PHP] Array

2009-08-10 Thread Robert Cummings
Ron Piggott wrote: How do I change this ELSEIF into an array? } elseif ( ( $page ) AND ( $page home_page ) AND ( $page verse_of_the_day_activate ) AND ( $page member_services ) AND ( $page member_services_login ) AND ( $page member_services_logoff ) AND ( $page resource_center ) AND (

[PHP] Is there any considerations for not putting php scripts in tmpfs?

2009-08-10 Thread Peter Wang
Hi php-general, sorry if it is a wrong lists for this question. I have read many articles/messages about using tmpfs store temp files, for example, php session data, smarty compied templates and so on. An obvious reason for that is: it doesn't matter about data loss caused by machine

Re: [PHP] Is there any considerations for not putting php scripts in tmpfs?

2009-08-10 Thread Richard Quadling
2009/8/10 Peter Wang ptr.w...@gmail.com: Hi php-general, sorry if it is a wrong lists for this question. I have read many articles/messages about using tmpfs store temp files, for example, php session data, smarty compied templates and so on. An obvious reason for that is: it doesn't

Re: [PHP] Is there any considerations for not putting php scripts in tmpfs?

2009-08-10 Thread Peter Wang
hi,thanks for your reply. On Mon, Aug 10, 2009 at 9:54 PM, Richard Quadling rquadl...@googlemail.comwrote: 2009/8/10 Peter Wang ptr.w...@gmail.com: Hi php-general, sorry if it is a wrong lists for this question. I have read many articles/messages about using tmpfs store temp files,

RE: [PHP] Radio buttons problem

2009-08-10 Thread tedd
-Original Message- From: leledumbo [mailto:leledumbo_c...@yahoo.co.id] Sent: 10 August 2009 11:11 To: php-general@lists.php.net Subject: RE: [PHP] Radio buttons problem There is, the entries are grouped by its index. So, I group name[0], email[0], and sex[0] as one. The

Re: [PHP] Array

2009-08-10 Thread Jim Lucas
Ron Piggott wrote: How do I change this ELSEIF into an array? } elseif ( ( $page ) AND ( $page home_page ) AND ( $page verse_of_the_day_activate ) AND ( $page member_services ) AND ( $page member_services_login ) AND ( $page member_services_logoff ) AND ( $page resource_center )

[PHP] Re: Array

2009-08-10 Thread Colin Guthrie
'Twas brillig, and Jim Lucas at 10/08/09 16:29 did gyre and gimble: $d = array( home_page, member_services, member_services_login, network, resource_center, verse_of_the_day_activate, ); Ahh someone else who always puts a closing , on the end of

Re: [PHP] reason for a Notice:.. on one site but not another? (Same code.)

2009-08-10 Thread Shawn McKenzie
John Butler wrote: if(isset($_POST['UserWishesDateRange']) $_POST['UserWishesDateRange'] == 'T') { Thought I tried that. Apparently not exactly; it works now! Thanks. I know it is clunky but I wanted to see how compact it could be done. If you switch it around you'll get a notice

Re: [PHP] Re: Array

2009-08-10 Thread Robert Cummings
Colin Guthrie wrote: 'Twas brillig, and Jim Lucas at 10/08/09 16:29 did gyre and gimble: $d = array( home_page, member_services, member_services_login, network, resource_center, verse_of_the_day_activate, ); Ahh someone else who always puts a

Re: [PHP] reason for a Notice:.. on one site but not another? (Same code.)

2009-08-10 Thread John Butler
If you switch it around you'll get a notice because the IF evaluates from left to right. So you just want to make sure you check isset() first. This would throw a notice: if($_POST['UserWishesDateRange'] == 'T' isset($_POST['UserWishesDateRange'])) { Aha! That must be what I tried

Re: [PHP] reason for a Notice:.. on one site but not another? (Same code.)

2009-08-10 Thread Martin Scotta
Why do you all always use isset? Why do you don't use array_key_exists instead? is it a more semantic solution? ?php $key = 'UserWishesDateRange'; # just to make statement shorter if( array_key_exists($key, $_POST ) 'T' == $_POST[$key] ) { echo ' the key exists... and it is a T ''; }

Re: [PHP] reason for a Notice:.. on one site but not another? (Same code.)

2009-08-10 Thread Ralph Deffke
this is not intelligence its just pure math. the '' says if BOTH expressions are true then the whole expression is true. so if the first one is false, the whole is false, why checking the next one in the underlaying C it would be something like this { if ( expression == false ) return false; if (

Re: [PHP] reason for a Notice:.. on one site but not another? (Same code.)

2009-08-10 Thread Eddie Drapkin
On Mon, Aug 10, 2009 at 1:07 PM, Martin Scottamartinsco...@gmail.com wrote: Why do you all always use isset? Why do you don't use array_key_exists instead? is it a more semantic solution? ?php $key = 'UserWishesDateRange'; # just to make statement shorter if( array_key_exists($key, $_POST

Re: [PHP] reason for a Notice:.. on one site but not another? (Same code.)

2009-08-10 Thread John Butler
If you switch it around you'll get a notice because the IF evaluates from left to right. So you just want to make sure you check isset() first. This would throw a notice: if($_POST['UserWishesDateRange'] == 'T' isset($_POST['UserWishesDateRange'])) { Aha! That must be what I tried and

Re: [PHP] reason for a Notice:.. on one site but not another? (Same code.)

2009-08-10 Thread Andrew Ballard
On Mon, Aug 10, 2009 at 1:50 PM, Ralph Deffkeralph_def...@yahoo.de wrote: this is not intelligence its just pure math. the '' says if BOTH expressions are true then the whole expression is true. so if the first one is false, the whole is false, why checking the next one in the underlaying C

Re: [PHP] reason for a Notice:.. on one site but not another? (Same code.)

2009-08-10 Thread Martin Scotta
This intelligence is given by the laziness of the operator. $res = a() b(); # if a() is false then b() does not evaluate $res = a() b(); # b() evaluates no matter a()'s result so, order matters. On Mon, Aug 10, 2009 at 3:29 PM, Andrew Ballard aball...@gmail.com wrote: On Mon, Aug 10, 2009

AW: [PHP] reason for a Notice:.. on one site but not another? (Same code.)

2009-08-10 Thread Ralph Deffke
the single is a logical AND so a() NOR b() is evaluatet ! its usually used on binary integer. e.g. 0x0001 0x0001 = 0x0001 equlals TRUE while 0x0002 0x0001 equals FALSE so something like $a $b guides to some very interisting results depending of their values but nothing u expect. while

Re: [PHP] reason for a Notice:.. on one site but not another? (Same code.)

2009-08-10 Thread Adam Randall
That should be !== not !=== Adam. On Mon, Aug 10, 2009 at 12:17 PM, Ralph Deffkeralph_def...@yahoo.de wrote: for the same story there are the -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Embedded foreach loops

2009-08-10 Thread John Butler
On Aug 10, 2009, at 3:43 PM, Jim Lucas wrote: Allen McCabe wrote: I am creating an order form for tickets for a list of performances at a performing arts center. Currently, the form is on paper, and is set up as follows: -Nutcracker - Tues 10/13 - 11am - $4.00 Thanks for letting us know

Re: [PHP] Embedding foreach loops

2009-08-10 Thread Jonathan Tapicer
On Mon, Aug 10, 2009 at 6:44 PM, Allen McCabeallenmcc...@gmail.com wrote: Gmail automatically sent my last email, apologies. I am creating an order form for tickets for a list of performances at a performing arts center. Currently, the form is on paper, and is set up as follows: -Title    

Re: [PHP] Embedding foreach loops

2009-08-10 Thread John Butler
I can't seem to get my foreach loops to work, will PHP parse embedded loops? yes. Is this something I need to have in a database to work? no, you can do it with the arrays... but it may be easier to work with over the long run if that data was in a db. Anyway right after you finish

[PHP] how to say inverse your value (to a boolean)?

2009-08-10 Thread John Butler
quick Q: I have this inside a foreach{} that I want to alternate between on and off so I can alternate the background-color of my tr's. $tableRowBGcolorBoolCounter != $tableRowBGcolorBoolCounter; //-boolean on and off I am looking thru' docs and books, but can't remember (nor find now)

Re: [PHP] Embedding foreach loops

2009-08-10 Thread Allen McCabe
John, I did this, and got my arrays dumped (on one line). After adding line returns, here is a snippet: [code=array dump] array(38) { [show_01]= array(5) { [title]= string(29) Van Cliburn Gold Medal Winner [date]= string(16) Tues. 10/13/2009 [time]= string(4) 11am [price]= float(4) [soldout]=

[PHP] Re: how to say inverse your value (to a boolean)?

2009-08-10 Thread Tony Marston
Try $tableRowBGcolorBoolCounter = !$tableRowBGcolorBoolCounter Notice that it says '= !' instead of !='. -- Tony Marston http://www.tonymarston.net http://www.radicore.org John Butler govinda.webdnat...@gmail.com wrote in message news:52842d6f-dd45-44a6-ae06-2e58ef8f6...@gmail.com... quick Q:

Re: [PHP] how to say inverse your value (to a boolean)?

2009-08-10 Thread Martin Scotta
You can do this... for( $b=true; your-statement; $b = !$b ) { your-code } I usually use this solution $types = array( 'one', 'two' ); foreach( $list as $item ) # -- your set of (many) items { echo current( $types ); # -- this prints the current class # code next( $types ) or

Re: [PHP] Embedding foreach loops

2009-08-10 Thread John Butler
I did this, and got my arrays dumped (on one line). After adding line returns, here is a snippet: it looks OK. Note that you can see (copy/paste) that array which you just dumped, much better, if you view the source code of the html page. OR you can use pre to make that format persist

[PHP] Re: how to say inverse your value (to a boolean)?

2009-08-10 Thread Ralph Deffke
with XOR try this $a = 0; echo $a ^ 1; $a = 1; echo $a ^ 1; hope that helps ralph ralph_def...@yahoo.de John Butler govinda.webdnat...@gmail.com wrote in message news:52842d6f-dd45-44a6-ae06-2e58ef8f6...@gmail.com... quick Q: I have this inside a foreach{} that I want to alternate between

Re: [PHP] Embedding foreach loops

2009-08-10 Thread Allen McCabe
I am using the print function to display my html. I cannot get the line return ( \n ) character to actually push the html onto the next line, it just gets displayed instead. Should I be using echo? On Mon, Aug 10, 2009 at 3:41 PM, John Butler govinda.webdnat...@gmail.comwrote: I did this,

Re: [PHP] Embedding foreach loops

2009-08-10 Thread Ben Dunlap
$shows = array();  $show_01 = array();  $show_01['title'] = 'Van Cliburn Gold Medal Winner';  $show_01['date'] = 'Tues. 10/13/2009';  $show_01['time'] = '11am';  $show_01['price'] = 4.00;  $show_01['soldout'] = 0; //IF THE SHOW SELLS OUT, CHANGE 0 to 1 (without quotations).  

RE: [PHP] Embedding foreach loops

2009-08-10 Thread Daevid Vincent
You're not using the pre and /pre tag most likely then. -Original Message- From: Allen McCabe [mailto:allenmcc...@gmail.com] Sent: Monday, August 10, 2009 4:11 PM To: John Butler Cc: phpList Subject: Re: [PHP] Embedding foreach loops I am using the print function to display my

RE: [PHP] how to say inverse your value (to a boolean)?

2009-08-10 Thread Daevid Vincent
NO! For the love of God and all that is holy, don't do that accumulator / mod hack. That's so 1980's. And why make the CPU do all that math for every row... Just do this. It's quick and simple: CSS: .dataRow1 { background-color: #DFDFDF; } .dataRow2 { background-color:

Re: [PHP] Embedding foreach loops

2009-08-10 Thread Ben Dunlap
I am using the print function to display my html. I cannot get the line return ( \n ) character to actually push the html onto the next line, it just gets displayed instead. Should I be using echo? In the PHP code snippet you pasted above, you're using single-quotes to delimit your literal

Re: [PHP] APC optimization in CLI

2009-08-10 Thread Nathan Nobbe
On Mon, Aug 10, 2009 at 4:58 PM, Daevid Vincent dae...@daevid.com wrote: From: Robert Cummings [mailto:rob...@interjinn.com] However, accelerators don't make scripts faster per se. They merely cut out the script reading and parsing time. Which is a HUGE portion of time since PHP is a

[PHP] Re: MySQL auto_increment fields Server version: 5.1.32-community-log

2009-08-10 Thread Ollisso
On Sun, 09 Aug 2009 21:17:15 +0300, Ralph Deffke ralph_def...@yahoo.de wrote: Hi all, I'm facing the fact that it seems that auto_increment fields in a table not start at 1 like it was in earlier versions even if I install mySQL brand new creating all tables new. it seems to me that

Re: [PHP] Embedding foreach loops

2009-08-10 Thread John Butler
I am using the print function to display my html. I cannot get the line return ( \n ) character to actually push the html onto the next line, it just gets displayed instead. Should I be using echo? Allen, you off and running again? echo blah.. \n; //-- this will print the literal 'blah..

Re: [PHP] how to say inverse your value (to a boolean)?

2009-08-10 Thread Martin Scotta
Use... $dr = !$dr if you want Notice: Undefined variable: dr All variables MUST be initialized before using. If you PHP does not complains about it you should read about error_reporting On Mon, Aug 10, 2009 at 8:18 PM, Daevid Vincent dae...@daevid.com wrote: NO! For the love of God and

[PHP] Re: how to say inverse your value (to a boolean)?

2009-08-10 Thread Ralph Deffke
u... try echo pre; for( $i=0 ; $i10; $i++){ echo something . (($a = $a^1) ? red\n : green\n); } echo /pre; watchout the brackets ! cheers ralph_def...@yahoo.de John Butler govinda.webdnat...@gmail.com wrote in message news:52842d6f-dd45-44a6-ae06-2e58ef8f6...@gmail.com... quick Q: I

RE: [PHP] how to say inverse your value (to a boolean)?

2009-08-10 Thread Daevid Vincent
Then YOU have more aggressive error_reporting than the default setting turned on. You might consider turning it down a notch. NOTICEs are basically useless and bloat your code IMHO -- and apparently the PHP devs too as per this... http://us2.php.net/manual/en/function.error-reporting.php //

Re: [PHP] Re: how to say inverse your value (to a boolean)?

2009-08-10 Thread John Butler
echo something . (($a = $a^1) ? red\n : green\n); Re: The ? char in this line above.. where in the php docs can I read about what that is doing? I have not come across this construct before today, from you guys. thanks -John -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Re: how to say inverse your value (to a boolean)?

2009-08-10 Thread Adam Randall
http://us3.php.net/manual/en/language.operators.comparison.php Find Ternary on that page. It's a shortened conditional: cond ? true : false Adam. On Mon, Aug 10, 2009 at 6:27 PM, John Butlergovinda.webdnat...@gmail.com wrote:  echo something . (($a = $a^1) ? red\n : green\n); Re: The ?

[PHP] Sending email w/ attachments

2009-08-10 Thread Skip Evans
Hey all, Trying to send emails with attachments, first try at this. And am trying to adapt sample code I found here: http://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php Trying this: ($data contains the contents of the file; I've verified this) $hash = md5(date('r',

Re: [PHP] Sending email w/ attachments

2009-08-10 Thread Bastien Koert
On Mon, Aug 10, 2009 at 9:49 PM, Skip Evanss...@bigskypenguin.com wrote: Hey all, Trying to send emails with attachments, first try at this. And am trying to adapt sample code I found here: http://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php Trying this: ($data contains

RE: [PHP] Re: how to say inverse your value (to a boolean)?

2009-08-10 Thread Daevid Vincent
Pretty much the best operator ever invented IMHO. And Since PHP 5.3, it is possible to leave out the middle part of the ternary operator. Expression expr1 ?: expr3 returns expr1 if expr1 evaluates to TRUE, and expr3 otherwise. Awesome! Also, Adam Randall set up us the bomb. ;-)

Re: [PHP] Re: how to say inverse your value (to a boolean)?

2009-08-10 Thread Adam Randall
No...not zerowing...no... But yes, the ternary operator is the bomb, which you can get carried away with. Daevid knows what I mean :) Adam. On Mon, Aug 10, 2009 at 6:59 PM, Daevid Vincentdae...@daevid.com wrote: Pretty much the best operator ever invented IMHO. And Since PHP 5.3, it is

Re: [PHP] Sending email w/ attachments

2009-08-10 Thread Adam Randall
Funny, I just had to figure out today how to nicely do HTML e-mails. I ended up using PEAR:Mail_mime, and it worked pretty well. It will also work for your attachments. I believe that PHP itself recommends it on their mail() function reference page. Adam. On Mon, Aug 10, 2009 at 6:49 PM, Skip

Re: [PHP] how to say inverse your value (to a boolean)?

2009-08-10 Thread Paul M Foster
On Mon, Aug 10, 2009 at 04:18:29PM -0700, Daevid Vincent wrote: NO! For the love of God and all that is holy, don't do that accumulator / mod hack. That's so 1980's. And why make the CPU do all that math for every row... Just do this. It's quick and simple: CSS: .dataRow1 {

Re: [PHP] Sending email w/ attachments

2009-08-10 Thread Skip Evans
Bastien Koert wrote: Use PHPMailer or one of the other classes available...makes life so much easier eric cartman Kick Ass!!! /eric cartman Yes! Wow! Was that a breeze! That class rocks! Thanks tons, Bastien! I have to admit when I first saw your reply I thought, Oh, man,

Re: [PHP] how to say inverse your value (to a boolean)?

2009-08-10 Thread Jim Lucas
Daevid Vincent wrote: NO! For the love of God and all that is holy, don't do that accumulator / mod hack. That's so 1980's. And why make the CPU do all that math for every row... Just do this. It's quick and simple: CSS: .dataRow1 { background-color: #DFDFDF; } .dataRow2

Re: [PHP] Re: Buffered Logging?

2009-08-10 Thread Waynn Lue
Thanks for all the help! I'm going to try just writing to a database table first with INSERT DELAYED, and if there ends up being a performance hit, I'll use a MEMORY table that gets archived off every 5 minutes or so. Waynn