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
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
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
--
-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,
-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
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 ) )
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 (
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 (
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
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
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,
-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
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 )
'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
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
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
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
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 '';
}
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 (
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
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
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
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
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
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
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
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
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
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)
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]=
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:
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
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
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
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,
$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).
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
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:
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
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
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
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..
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
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
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
//
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
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 ?
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',
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
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. ;-)
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
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
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 {
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,
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
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
56 matches
Mail list logo