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 r

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 re

[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"

Re: [PHP] Array

2009-08-10 Thread Jonathan Tapicer
On Mon, Aug 10, 2009 at 9:28 AM, 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 <>

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 <>

[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 restart/pow

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

2009-08-10 Thread Richard Quadling
2009/8/10 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 dat

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 wrote: > 2009/8/10 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 dat

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 (

[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

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 no

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 alway

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 a

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? wrote: > >>> 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 thr

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; i

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 Scotta wrote: > Why do you all always use isset? > Why do you don't use array_key_exists instead? is it a more semantic > solution? > > > $key = 'UserWishesDateRange'; # just to make statement shorter > if( array_key_exists($key, $_POST ) && 'T' == $_POST[$k

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 Deffke 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 it would be so

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 wrote: > On Mon, Aug 10, 2009 at 1:50 PM,

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 Deffke 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

[PHP] Embedded foreach loops

2009-08-10 Thread Allen McCabe
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

Re: [PHP] Re: Array

2009-08-10 Thread Jim Lucas
Robert Cummings wrote: > 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", >>

Re: [PHP] Embedded foreach loops

2009-08-10 Thread Jim Lucas
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 about your new order form. Did you have a

[PHP] Embedding foreach loops

2009-08-10 Thread Allen McCabe
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 - date - time - price - soldout - quantity - total($) -Nutcracker - Tues 10/13

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 McCabe 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     - date  - time

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 cre

[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 's. $tableRowBGcolorBoolCounter != $tableRowBGcolorBoolCounter; //-boolean on and off I am looking thru' docs and books, but can't remember (nor find now) in

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"]=> f

[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" wrote in message news:52842d6f-dd45-44a6-ae06-2e58ef8f6...@gmail.com... > quick Q: > I have this inside a fo

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

2009-08-10 Thread Martin Scotta
You can do this... for( $b=true; ; $b = !$b ) { } 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 reset( $types ); # and th

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 to make that format persist thr

Re: [PHP] Embedding foreach loops

2009-08-10 Thread Martin Scotta
There are a lot of alternatives if you want to remove the arrays XML, ini files, text files, yaml, json Of course... they all will implicate to open the file, read it, and then process it. On Mon, Aug 10, 2009 at 7:29 PM, Allen McCabe wrote: > John, > > I did this, and got my arrays dumped (

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

2009-08-10 Thread John Butler
= ! ! =) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[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" 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 on > and off so I can alte

RE: [PHP] APC optimization in CLI

2009-08-10 Thread Daevid Vincent
> 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 two-pass step. One that reads and compiles to opcodes (with syntax checking

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

2009-08-10 Thread Jim Lucas
John Butler wrote: > 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 's. > > $tableRowBGcolorBoolCounter != $tableRowBGcolorBoolCounter; //-boolean > on and off > > I am looking thru' docs and books, but can't

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 wrote: > > I did this, and got my arrays dumped (on

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 and 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: #FFF

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 s

Re: [PHP] APC optimization in CLI

2009-08-10 Thread Nathan Nobbe
On Mon, Aug 10, 2009 at 4:58 PM, Daevid Vincent 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 two-pass s

[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" 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 auto_increments handlin

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 wrote: > NO! For the love of God and all that is holy,

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

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

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 // Repor

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 u

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 Butler wrote: >>  echo "something " . (($a = $a^1) ? "red\n" : "green\n"); > > Re: The "?" char in this

[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', time()))

Re: [PHP] Sending email w/ attachments

2009-08-10 Thread Bastien Koert
On Mon, Aug 10, 2009 at 9:49 PM, Skip Evans 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 the contents

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. ;-) (http://www.youtub

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 Vincent wrote: > Pretty much the best operator ever invented IMHO. And Since PHP 5.3, it is > possible to leave out

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 Eva

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: > .data

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 Kick Ass!!! 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, another class to learn? But

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

Re: [PHP] Embedding foreach loops

2009-08-10 Thread hessiess
Do *NOT* get into the habit of outputting your HTML using echo or print statements, it becomes unmaintainable very quickly, use a templating language, ether with a framework(recomended) or standalone. You should learn the basics of HTML and CSS, go and read http://htmldog.com/, btw to add a newlin

RE: [PHP] Radio buttons problem

2009-08-10 Thread leledumbo
> Unless, of course, what you have is > >name[], email[], sex[0] >name[], email[], sex[1] >name[], email[], sex[2] Yep, that's exactly what I have. > If it's important to you that the indexes match across name[], email[] and > sex[], then you must supply > them explicitly for every

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

2009-08-10 Thread Ashley Sheridan
On Mon, 2009-08-10 at 15:40 -0300, Martin Scotta wrote: > 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, 200