php-general Digest 27 Jan 2009 13:05:57 -0000 Issue 5925

2009-01-27 Thread php-general-digest-help

php-general Digest 27 Jan 2009 13:05:57 - Issue 5925

Topics (messages 287193 through 287209):

Variable formatting problem using sessions...
287193 by: Rick Duval
287198 by: Chris

Re: Coding for email response forms
287194 by: Edmund Hertle

Re: Multiple queries in PHP
287195 by: Edmund Hertle
287197 by: Chris

Re: PHP 5.2.8 fails to find libiconv
287196 by: Chris

Doc standard for methods?
287199 by: Larry Garfield

Re: Make New-Age Money Online with Google
287200 by: clive
287201 by: Stuart
287206 by: Martin Zvarík

Get Money Fast with the Government Grants
287202 by: Dora Gaskins
287203 by: clive
287204 by: Andrew Williams

Re: best practice wrt multi-lingual websites, gettext() etc.
287205 by: Per Jessen
287207 by: Jan Ka¹tánek
287208 by: Per Jessen
287209 by: Phpster

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
I'm using an OnClick routine to set a session variable before I go
to another page.

onClick=?php $_SESSION['local_part']= 'rick'; ?   works fine but I
need a variable where rick is

I've tried

onClick=?php $_SESSION['local_part']= $local_part; ?

and other variations but it doesn't work.

Can anybody tell me what the proper formatting is to get this to
resolve correctly?

Thanks

Rick
---End Message---
---BeginMessage---

Rick Duval wrote:

I'm using an OnClick routine to set a session variable before I go
to another page.

onClick=?php $_SESSION['local_part']= 'rick'; ?   works fine but I
need a variable where rick is

I've tried

onClick=?php $_SESSION['local_part']= $local_part; ?

and other variations but it doesn't work.

Can anybody tell me what the proper formatting is to get this to
resolve correctly?


Not sure what you're trying to do exactly, but if you're trying to get 
the 'onClick' to set the $_SESSION['local_part'] variable, it won't.


onClick is handled by your browser. PHP runs from the server and has no 
idea what your browser is doing.


You either need to do an ajax call to connect to the server, set the 
session var, then do the page redirect - or use a get variable and use 
that on the next page.


--
Postgresql  php tutorials
http://www.designmagick.com/

---End Message---
---BeginMessage---
2009/1/26 Tom obeli...@comcast.net


 Shawn McKenzie sh...@mckenzies.net wrote in message
 news:497e3ab9.2060...@mckenzies.net...
 
 
  Shawn McKenzie wrote:
 
  Tom Scott wrote:
  - Original Message - From: Shawn McKenzie
  nos...@mckenzies.net
  Newsgroups: php.general
  To: php-gene...@lists.php.net
  Sent: Monday, January 26, 2009 3:52 PM
  Subject: Re: [PHP] Coding for email response forms
 
 
  Tom wrote:
  Shawn McKenzie  wrote in message
  news:a0.87.62571.3d92e...@pb1.pair.com...
  Tom wrote:
  My Hosting site said that I needed to include the PHP otherwise
  the form
  won't work. I need to know where to include my email info to get
  this set
  up
  don't I? What do you suggest?
  T
  Daniel Brown danbr...@php.net wrote in message
  news:ab5568160901261259p6d6442a4ya5ea4134025e5...@mail.gmail.com.
 ..
  On Mon, Jan 26, 2009 at 15:57, Tom obeli...@comcast.net wrote:
  I am a new user of PHP, and am using Dreamweaver CS3 for the
  webpages.
  The
  following page has my form but the submit button is not working
  properly.
  http://www.richlandmtg.com/contacts.html
  What code is needed and where does it get placed in the page.? I
  thought
  CS3
  took care of this.
 Tom,
 
 This issue has nothing at all to do with PHP.  This is all
  client
  side (JavaScript and HTML).
 
  --
  /Daniel P. Brown
  daniel.br...@parasane.net || danbr...@php.net
  http://www.parasane.net/ || http://www.pilotpig.net/
  Unadvertised dedicated server deals, too low to print - email me
  to find
  out!
  What you have now is a form that when submitted sends the data to
  itself.  So you either need to include some php in this file to
  gather
  up the data and email it when submitted, or submit to another file
  that
  does that.
 
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com
  Shawn,
  So would that look something like this:
  ?
  if ($_SERVER['REQUEST_METHOD'] == POST) {
 
  // Just to be safe, I strip out HTML tags
  $realname = strip_tags($realname);
  $email = strip_tags($email);
  $feedback = strip_tags($feedback);
 
  // set the variables
  // replace $...@mysite.com with your email
  $sendto = $...@mysite.com;
  $subject = Sending Email Feedback From My Website;
  $message = $realname, $email\n\n$feedback;
 
  // send the email
  mail($sendto, $subject, $message);
 
  }
  ?
 
 
 
  Oh, you should also think about some 

Re: [PHP] Make New-Age Money Online with Google

2009-01-27 Thread Stuart
2009/1/27 clive clive_li...@immigrationunit.com:
 Ashley Sheridan wrote:

 On Sat, 2009-01-24 at 10:14 +0200, Dora Elless wrote:


 That's why I am sending this email only to people I know and care
 about.


 And they send to a mailing list. Come again?



 So Funny, they went through all the trouble of signing up, unless hey have
 bots now that can sign up to mailing lists?

Yes they do - it's not hard, but you don't actually need to subscribe
to PHP mailing lists to post to them.

-Stuart

-- 
http://stut.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Get Money Fast with the Government Grants

2009-01-27 Thread clive

Dora Gaskins wrote:

If you have received this email, take a time to really read it carefully!

American Gov Money
More spam, can't we have the maillist software require people to 
register before posting?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Get Money Fast with the Government Grants

2009-01-27 Thread Andrew Williams
Hi,
Beware of he spam mailer so do not let them spam your money away.

Andrew

On Tue, Jan 27, 2009 at 9:18 AM, clive clive_li...@immigrationunit.comwrote:

 Dora Gaskins wrote:

 If you have received this email, take a time to really read it carefully!

 American Gov Money

 More spam, can't we have the maillist software require people to register
 before posting?


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 

Best Wishes
Andrew Williams
---
31 Davies Street
W1K 4LP, London, UK
www.NetPosten.dk


Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-27 Thread Per Jessen
Bastien Koert wrote:

 No, as all of our users have to authorized to use the app, we store
 the desired language in a field in the user record. However, we also
 supply functionality via a drop down to allow the user to change the
 language if desired.

Okay, that's very similar to my approach.  For first-time users (of
which I will have a lot), the language is set by their browser's
language setting.  Most users won't be changing it.

 I agree its difficult to separate the language and the code, but if
 you create xslt / html files for each language then its a much simpler
 matter, and far less resouce intensive, to direct the user to that
 page in their desired language. 

I leave that to Apache and the 'prefer-language' environment variable -
I guess my main issue is to do with e.g. error-messages from PHP code
(please complete this field correctly etc) and from javascript ditto. 

I guess for error-messages, it's back to gettext(), which does make some
sense. 

 Again, you and just use PHP and handle the labels and option (drop
 downs, radios etc) variables in real time  but I never see the point
 in doing the same thing over and over again when its much cleaner (if
 more management intensive)  to direct the user to a static resource
 and pass in an XML string with the data in it.

Totally agree. 

 At work, we don't use gettext() since :
 a) its an classic ASP shop (  :-(  ), therefore no Linux and no PHP

Ah. :-)

 b) the db current doesn't support multi-byte charsets
 

The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Make New-Age Money Online with Google

2009-01-27 Thread Martin Zvarík

Ashley Sheridan napsal(a):

On Sat, 2009-01-24 at 10:14 +0200, Dora Elless wrote:

That's why I am sending this email only to people I know and care
about.

And they send to a mailing list. Come again?


Ash
www.ashleysheridan.co.uk



The sad thing though is that there will be always people who believe 
this shit and pays...


Like my dad bought a little book Take off your glasses for $10 and he 
received 2 papers saying: sun is our best friend, look right into it and 
it will heal your eyes.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-27 Thread Jan Kaštánek
Per Jessen:

  The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.

It supports. We use it. But only in MsgStr (translation), not in MsgId
(original strings).

-- 
toby

http://toby.cz/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-27 Thread Per Jessen
Jan Kaštánek wrote:

 Per Jessen:

  The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.
 
 It supports. We use it. But only in MsgStr (translation), not in MsgId
 (original strings).
 

Yeah, I found out too.  (from the GNU gettext docu).


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-27 Thread Phpster

Sorry guys,

I meant that the current application database is not configured for  
utf-8


Bastien

Sent from my iPod

On Jan 27, 2009, at 6:04, Per Jessen p...@computer.org wrote:


Jan Kaštánek wrote:


Per Jessen:


The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.


It supports. We use it. But only in MsgStr (translation), not in  
MsgId

(original strings).



Yeah, I found out too.  (from the GNU gettext docu).


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Doc standard for methods?

2009-01-27 Thread Nathan Rixham

Larry Garfield wrote:
Greetings, all.  I am looking for feedback on a documentation question, in the 
hopes that someone else has found a good solution to an abnormal situation.


We're in the process of introducing OOP syntax to a large procedural code 
base.  Our developer base is a mixture of people who are procedural-centric 
and those that flip between procedural and OOP easily.  One area we've run into 
is documenting some of the more complex OOP interactions.  For example, if we 
have a method chain:


foo()-bar()-baz()-narf();

some developers have expressed concern in figuring out which narf() method is 
actually being called, since foo(), bar() and baz() may return objects of 
different classes (of the same interface) depending on various conditions (the 
classic factory pattern).  

Currently, we're including a docblock (Doxygen, close enough to PHPDoc for 
government work) on the interface or parent class that has full docs, and then 
nothing on the child classes.  My understanding of docblocks is that most 
documentation parsers prefer that, so that the docblock itself inherits.  

One suggestion that has been raised is to reference the parent class and 
factory function in a comment after the method signature.  That is:


class Narfing_mysql {
  // ...

 public function narf() { // Narfing  foo()
// ...
 }
}

So that it can be easily grepped for.  That strikes me as a very hacky non-
solution.  Does anyone else have a recommendation for how to improve such 
documentation?  Is there a standard in PHPDoc that I don't know about?  Any 
other projects doing something like that?





first idea would just be to use the @return; if they're using any kind 
decent of ide it'll show the return type; failing that they can check 
the docs


class Narfing_mysql {
 /**
  *
  * @return Type
  */
 public function narf() { // Narfing  foo()
// ...
 }
}

or not best practice but i dare say

class Narfing_mysql {
 /**
  *
  * @return TypeA, TypeB
  */
 public function narf() { // Narfing  foo()
// ...
 }
}

or in the method description with @see Class inline links?

regards

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Doc standard for methods?

2009-01-27 Thread Eric Butera
On Tue, Jan 27, 2009 at 10:00 AM, Kyle Terry k...@kyleterry.com wrote:
 On Tue, Jan 27, 2009 at 5:56 AM, Nathan Rixham nrix...@gmail.com wrote:
 Larry Garfield wrote:

 Greetings, all.  I am looking for feedback on a documentation question, in
 the hopes that someone else has found a good solution to an abnormal
 situation.

 We're in the process of introducing OOP syntax to a large procedural code
 base.  Our developer base is a mixture of people who are procedural-centric
 and those that flip between procedural and OOP easily.  One area we've run
 into is documenting some of the more complex OOP interactions.  For example,
 if we have a method chain:

 foo()-bar()-baz()-narf();

 some developers have expressed concern in figuring out which narf() method
 is actually being called, since foo(), bar() and baz() may return objects of
 different classes (of the same interface) depending on various conditions
 (the classic factory pattern).
 Currently, we're including a docblock (Doxygen, close enough to PHPDoc for
 government work) on the interface or parent class that has full docs, and
 then nothing on the child classes.  My understanding of docblocks is that
 most documentation parsers prefer that, so that the docblock itself
 inherits.
 One suggestion that has been raised is to reference the parent class and
 factory function in a comment after the method signature.  That is:

 class Narfing_mysql {
  // ...

  public function narf() { // Narfing  foo()
// ...
  }
 }

 So that it can be easily grepped for.  That strikes me as a very hacky
 non-
 solution.  Does anyone else have a recommendation for how to improve such
 documentation?  Is there a standard in PHPDoc that I don't know about?  Any
 other projects doing something like that?



 first idea would just be to use the @return; if they're using any kind
 decent of ide it'll show the return type; failing that they can check the
 docs

 class Narfing_mysql {
  /**
  *
  * @return Type
  */
  public function narf() { // Narfing  foo()
// ...
  }
 }

 or not best practice but i dare say

 class Narfing_mysql {
  /**
  *
  * @return TypeA, TypeB
  */
  public function narf() { // Narfing  foo()
// ...
  }
 }

 or in the method description with @see Class inline links?

 regards

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 Eric and I were just discussing something similar yesterday. We
 discovered you can make private and protected method calls from two
 different instances of the same object type. I personally called this
 reference hopping.

 --
 Kyle Terry | www.kyleterry.com
 Help kick start VOOM (Very Open Object Model) for a library of PHP classes.
 http://www.voom.me | IRC EFNet #voom

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



And I called it haxx. ;)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Make New-Age Money Online with Google

2009-01-27 Thread Eric Butera
On Tue, Jan 27, 2009 at 2:42 AM, clive clive_li...@immigrationunit.com wrote:
 So Funny, they went through all the trouble of signing up, unless hey have
 bots now that can sign up to mailing lists?

Could be a virus that is spamming all contacts in a real persons email client.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Make New-Age Money Online with Google

2009-01-27 Thread Matty Sarro
OMG THIS IS SO AWESOME!
Dear Bot/Advertiser:
Please find a fire, and die in it. Thank you.
-Matthew

On Tue, Jan 27, 2009 at 10:08 AM, Eric Butera eric.but...@gmail.com wrote:

 On Tue, Jan 27, 2009 at 2:42 AM, clive clive_li...@immigrationunit.com
 wrote:
  So Funny, they went through all the trouble of signing up, unless hey
 have
  bots now that can sign up to mailing lists?

 Could be a virus that is spamming all contacts in a real persons email
 client.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Doc standard for methods?

2009-01-27 Thread Kyle Terry
On Tue, Jan 27, 2009 at 5:56 AM, Nathan Rixham nrix...@gmail.com wrote:
 Larry Garfield wrote:

 Greetings, all.  I am looking for feedback on a documentation question, in
 the hopes that someone else has found a good solution to an abnormal
 situation.

 We're in the process of introducing OOP syntax to a large procedural code
 base.  Our developer base is a mixture of people who are procedural-centric
 and those that flip between procedural and OOP easily.  One area we've run
 into is documenting some of the more complex OOP interactions.  For example,
 if we have a method chain:

 foo()-bar()-baz()-narf();

 some developers have expressed concern in figuring out which narf() method
 is actually being called, since foo(), bar() and baz() may return objects of
 different classes (of the same interface) depending on various conditions
 (the classic factory pattern).
 Currently, we're including a docblock (Doxygen, close enough to PHPDoc for
 government work) on the interface or parent class that has full docs, and
 then nothing on the child classes.  My understanding of docblocks is that
 most documentation parsers prefer that, so that the docblock itself
 inherits.
 One suggestion that has been raised is to reference the parent class and
 factory function in a comment after the method signature.  That is:

 class Narfing_mysql {
  // ...

  public function narf() { // Narfing  foo()
// ...
  }
 }

 So that it can be easily grepped for.  That strikes me as a very hacky
 non-
 solution.  Does anyone else have a recommendation for how to improve such
 documentation?  Is there a standard in PHPDoc that I don't know about?  Any
 other projects doing something like that?



 first idea would just be to use the @return; if they're using any kind
 decent of ide it'll show the return type; failing that they can check the
 docs

 class Narfing_mysql {
  /**
  *
  * @return Type
  */
  public function narf() { // Narfing  foo()
// ...
  }
 }

 or not best practice but i dare say

 class Narfing_mysql {
  /**
  *
  * @return TypeA, TypeB
  */
  public function narf() { // Narfing  foo()
// ...
  }
 }

 or in the method description with @see Class inline links?

 regards

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Eric and I were just discussing something similar yesterday. We
discovered you can make private and protected method calls from two
different instances of the same object type. I personally called this
reference hopping.

-- 
Kyle Terry | www.kyleterry.com
Help kick start VOOM (Very Open Object Model) for a library of PHP classes.
http://www.voom.me | IRC EFNet #voom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Doc standard for methods?

2009-01-27 Thread Kyle Terry
On Tue, Jan 27, 2009 at 7:06 AM, Eric Butera eric.but...@gmail.com wrote:
 On Tue, Jan 27, 2009 at 10:00 AM, Kyle Terry k...@kyleterry.com wrote:
 On Tue, Jan 27, 2009 at 5:56 AM, Nathan Rixham nrix...@gmail.com wrote:
 Larry Garfield wrote:

 Greetings, all.  I am looking for feedback on a documentation question, in
 the hopes that someone else has found a good solution to an abnormal
 situation.

 We're in the process of introducing OOP syntax to a large procedural code
 base.  Our developer base is a mixture of people who are procedural-centric
 and those that flip between procedural and OOP easily.  One area we've run
 into is documenting some of the more complex OOP interactions.  For 
 example,
 if we have a method chain:

 foo()-bar()-baz()-narf();

 some developers have expressed concern in figuring out which narf() method
 is actually being called, since foo(), bar() and baz() may return objects 
 of
 different classes (of the same interface) depending on various conditions
 (the classic factory pattern).
 Currently, we're including a docblock (Doxygen, close enough to PHPDoc for
 government work) on the interface or parent class that has full docs, and
 then nothing on the child classes.  My understanding of docblocks is that
 most documentation parsers prefer that, so that the docblock itself
 inherits.
 One suggestion that has been raised is to reference the parent class and
 factory function in a comment after the method signature.  That is:

 class Narfing_mysql {
  // ...

  public function narf() { // Narfing  foo()
// ...
  }
 }

 So that it can be easily grepped for.  That strikes me as a very hacky
 non-
 solution.  Does anyone else have a recommendation for how to improve such
 documentation?  Is there a standard in PHPDoc that I don't know about?  Any
 other projects doing something like that?



 first idea would just be to use the @return; if they're using any kind
 decent of ide it'll show the return type; failing that they can check the
 docs

 class Narfing_mysql {
  /**
  *
  * @return Type
  */
  public function narf() { // Narfing  foo()
// ...
  }
 }

 or not best practice but i dare say

 class Narfing_mysql {
  /**
  *
  * @return TypeA, TypeB
  */
  public function narf() { // Narfing  foo()
// ...
  }
 }

 or in the method description with @see Class inline links?

 regards

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 Eric and I were just discussing something similar yesterday. We
 discovered you can make private and protected method calls from two
 different instances of the same object type. I personally called this
 reference hopping.

 --
 Kyle Terry | www.kyleterry.com
 Help kick start VOOM (Very Open Object Model) for a library of PHP classes.
 http://www.voom.me | IRC EFNet #voom

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 And I called it haxx. ;)


Never said we used it :) Remember my coworkers responce ... FNE!

-- 
Kyle Terry | www.kyleterry.com
Help kick start VOOM (Very Open Object Model) for a library of PHP classes.
http://www.voom.me | IRC EFNet #voom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Coding for email response forms

2009-01-27 Thread Tom

Edmund Hertle edmund.her...@student.kit.edu wrote in message 
news:f7ed91b20901261644y125f71aer3e0b70735c949...@mail.gmail.com...
 2009/1/26 Tom obeli...@comcast.net


 Shawn McKenzie sh...@mckenzies.net wrote in message
 news:497e3ab9.2060...@mckenzies.net...
 
 
  Shawn McKenzie wrote:
 
  Tom Scott wrote:
  - Original Message - From: Shawn McKenzie
  nos...@mckenzies.net
  Newsgroups: php.general
  To: php-general@lists.php.net
  Sent: Monday, January 26, 2009 3:52 PM
  Subject: Re: [PHP] Coding for email response forms
 
 
  Tom wrote:
  Shawn McKenzie  wrote in message
  news:a0.87.62571.3d92e...@pb1.pair.com...
  Tom wrote:
  My Hosting site said that I needed to include the PHP otherwise
  the form
  won't work. I need to know where to include my email info to get
  this set
  up
  don't I? What do you suggest?
  T
  Daniel Brown danbr...@php.net wrote in message
  news:ab5568160901261259p6d6442a4ya5ea4134025e5...@mail.gmail.com.
 ..
  On Mon, Jan 26, 2009 at 15:57, Tom obeli...@comcast.net wrote:
  I am a new user of PHP, and am using Dreamweaver CS3 for the
  webpages.
  The
  following page has my form but the submit button is not working
  properly.
  http://www.richlandmtg.com/contacts.html
  What code is needed and where does it get placed in the page.? 
  I
  thought
  CS3
  took care of this.
 Tom,
 
 This issue has nothing at all to do with PHP.  This is all
  client
  side (JavaScript and HTML).
 
  --
  /Daniel P. Brown
  daniel.br...@parasane.net || danbr...@php.net
  http://www.parasane.net/ || http://www.pilotpig.net/
  Unadvertised dedicated server deals, too low to print - email me
  to find
  out!
  What you have now is a form that when submitted sends the data to
  itself.  So you either need to include some php in this file to
  gather
  up the data and email it when submitted, or submit to another file
  that
  does that.
 
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com
  Shawn,
  So would that look something like this:
  ?
  if ($_SERVER['REQUEST_METHOD'] == POST) {
 
  // Just to be safe, I strip out HTML tags
  $realname = strip_tags($realname);
  $email = strip_tags($email);
  $feedback = strip_tags($feedback);
 
  // set the variables
  // replace $...@mysite.com with your email
  $sendto = $...@mysite.com;
  $subject = Sending Email Feedback From My Website;
  $message = $realname, $email\n\n$feedback;
 
  // send the email
  mail($sendto, $subject, $message);
 
  }
  ?
 
 
 
  Oh, you should also think about some other things, such as 
  validation.
  Is realname only alpha characters?  Is email in the form of a real
  email
  address?  At a bare minimum, are they not empty:
 
  if (empty($_POST['email']) ||
  empty($_POST['realname']) ||
  empty($_POST['feedback']))
  {
 echo 'You must complete all required fields!';
  // show form again
  }
 
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com
  Ok. I have the validation part.
  http://www.richlandmtg.com/index-5.html still working on the Send
  button.
 
  T
 
 
  Please reply all so this stays on the list.
 
  1.  In the source for your link I see that the JS is doing some
  validation.
  2.  You have method=get in your form.  This will work, but you'll 
  have
  to change the PHP code to use $_GET instead of $_POST vars.  Or change
  to method=post in the form.
  3.  If you want to keep the .html extension for the page, then you'll
  probably need to send the post to another script with a .php 
  extension.
  Normally a file with a .html extension won't execute the PHP code.
 
  Thanks!
  -Shawn
 
 
 
 I was just looking at that. Someone told me to use GET instead of POST.
 Since JS is validating is it as easy replacing GET with POST ? Nothing 
 else
 needed? Is it better to remove the JS and just code using PHP as you 
 showed
 before?
 if (empty($_POST['email']) ||
 empty($_POST['realname']) ||
 empty($_POST['feedback']))

 Thanks,
 Tom


 Yes, I think it is better to just use PHP code and post is the better 
 method
 (in this case) because with get all your fields and values will show up in
 the url

 -eddy

I don't seem to be getting he hang of this. Sounds so simple but Can 
someone check this out and tell me where exactly I'm messing up? 
http://www.richlandmtg.com/Contact_Us.html
I removed the JS validation. Is the following code ok?

a href=# onClick=document.getElementById('form').reset()clear/aimg 
alt= src=images/ch_more_red.gif   style=margin:1px 0 0 3px; 
vertical-align:text-bottom/bb style=margin-left:17px;a href=# 
onClick=document.getElementById('form').submit()send/a

I posted the PHP info at the top of the page before the html tag. Should 
it be after html?

Sorry please bear with me,
Tom 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Coding for email response forms

2009-01-27 Thread Boyd, Todd M.
 -Original Message-
 From: Tom [mailto:obeli...@comcast.net]
 Sent: Tuesday, January 27, 2009 9:58 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Coding for email response forms
 
 
 Edmund Hertle edmund.her...@student.kit.edu wrote in message
 news:f7ed91b20901261644y125f71aer3e0b70735c949...@mail.gmail.com...
  2009/1/26 Tom obeli...@comcast.net
 
 
  Shawn McKenzie sh...@mckenzies.net wrote in message
  news:497e3ab9.2060...@mckenzies.net...
  
  
   Shawn McKenzie wrote:
  
   Tom Scott wrote:
   - Original Message - From: Shawn McKenzie
   nos...@mckenzies.net
   Newsgroups: php.general
   To: php-general@lists.php.net
   Sent: Monday, January 26, 2009 3:52 PM
   Subject: Re: [PHP] Coding for email response forms
  
  
   Tom wrote:
   Shawn McKenzie  wrote in message
   news:a0.87.62571.3d92e...@pb1.pair.com...
   Tom wrote:
   My Hosting site said that I needed to include the PHP
 otherwise
   the form
   won't work. I need to know where to include my email info
to
 get
   this set
   up
   don't I? What do you suggest?
   T
   Daniel Brown danbr...@php.net wrote in message
  
 news:ab5568160901261259p6d6442a4ya5ea4134025e5...@mail.gmail.com.
  ..
   On Mon, Jan 26, 2009 at 15:57, Tom obeli...@comcast.net
 wrote:
   I am a new user of PHP, and am using Dreamweaver CS3 for
 the
   webpages.
   The
   following page has my form but the submit button is not
 working
   properly.
   http://www.richlandmtg.com/contacts.html
   What code is needed and where does it get placed in the
 page.?
   I
   thought
   CS3
   took care of this.
  Tom,
  
  This issue has nothing at all to do with PHP.  This is
 all
   client
   side (JavaScript and HTML).
   What you have now is a form that when submitted sends the
 data to
   itself.  So you either need to include some php in this file
 to
   gather
   up the data and email it when submitted, or submit to
another
 file
   that
   does that.
   Shawn,
   So would that look something like this:
   ?
   if ($_SERVER['REQUEST_METHOD'] == POST) {
  
   // Just to be safe, I strip out HTML tags
   $realname = strip_tags($realname);
   $email = strip_tags($email);
   $feedback = strip_tags($feedback);
  
   // set the variables
   // replace $...@mysite.com with your email
   $sendto = $...@mysite.com;
   $subject = Sending Email Feedback From My Website;
   $message = $realname, $email\n\n$feedback;
  
   // send the email
   mail($sendto, $subject, $message);
  
   }
   ?
  
   Oh, you should also think about some other things, such as
   validation.
   Is realname only alpha characters?  Is email in the form of a
 real
   email
   address?  At a bare minimum, are they not empty:
  
   if (empty($_POST['email']) ||
   empty($_POST['realname']) ||
   empty($_POST['feedback']))
   {
  echo 'You must complete all required fields!';
   // show form again
   }
  
   Ok. I have the validation part.
   http://www.richlandmtg.com/index-5.html still working on the
 Send
   button.
  
   Please reply all so this stays on the list.
  
   1.  In the source for your link I see that the JS is doing some
   validation.
   2.  You have method=get in your form.  This will work, but
 you'll
   have
   to change the PHP code to use $_GET instead of $_POST vars.  Or
 change
   to method=post in the form.
   3.  If you want to keep the .html extension for the page, then
 you'll
   probably need to send the post to another script with a .php
   extension.
   Normally a file with a .html extension won't execute the PHP
 code.
  I was just looking at that. Someone told me to use GET instead of
 POST.
  Since JS is validating is it as easy replacing GET with POST ?
 Nothing
  else
  needed? Is it better to remove the JS and just code using PHP as
you
  showed
  before?
  if (empty($_POST['email']) ||
  empty($_POST['realname']) ||
  empty($_POST['feedback']))
 
  Yes, I think it is better to just use PHP code and post is the
better
  method
  (in this case) because with get all your fields and values will show
 up in
  the url
 
 I don't seem to be getting he hang of this. Sounds so simple but
 Can
 someone check this out and tell me where exactly I'm messing up?
 http://www.richlandmtg.com/Contact_Us.html
 I removed the JS validation. Is the following code ok?
 
 a href=#
 onClick=document.getElementById('form').reset()clear/aimg
 alt= src=images/ch_more_red.gif   style=margin:1px 0 0 3px;
 vertical-align:text-bottom/bb style=margin-left:17px;a
 href=#
 onClick=document.getElementById('form').submit()send/a
 
 I posted the PHP info at the top of the page before the html tag.
 Should
 it be after html?

Tom,

I don't think you're getting it... by the time the form is displayed on
the user's browser, PHP has wiped its hands clean of the whole ordeal.
PHP is used on the server ONLY. Javascript is used on the client ONLY.
PHP can take an HTTP request (when the browser REQUESTs a URL) and then
perform certain actions based on any number of conditions 

[PHP] Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread revDAVE
Hi Folks,

Newbie question

I have a mysql table with 100 fields, currently all do not allow nulls.
Rather than hand typing in phpMyAdmin, I would like a way to loop through
all fields and update them to allow nulls

My Beginning attempt needs help...


$i = 1;
while ($i = 100):

// how do I word this to just change whatever field we are on to allow
nulls?

$sql = 'ALTER TABLE `mytable` ?*update*? `'.$???WhatEverField??[$i].'`
?ALLOWNULL?;';

//mysql_query($sql);

$result = mysql_query($sql) or die(br /br / Could not renumber dB $sql
br /br / . mysql_error());


$i++;
endwhile;


Thanks in advance



--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread Jay Moore

revDAVE wrote:

Hi Folks,

Newbie question

I have a mysql table with 100 fields, currently all do not allow nulls.
Rather than hand typing in phpMyAdmin, I would like a way to loop through
all fields and update them to allow nulls


First I would DESCRIBE the table so you get a list of column names and 
attributes.  Then I would go thru each column and CHANGE it so it has 
the same attributes, adding the NULL flag if necessary.


There may be an easier way however.

Jay

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread Ian
On 27 Jan 2009 at 8:53, revDAVE wrote:

 Hi Folks,

 Newbie question

 I have a mysql table with 100 fields, currently all do not allow nulls.
 Rather than hand typing in phpMyAdmin, I would like a way to loop through
 all fields and update them to allow nulls

 My Beginning attempt needs help...


 $i = 1;
 while ($i = 100):

 // how do I word this to just change whatever field we are on to allow
 nulls?

 $sql = 'ALTER TABLE `mytable` ?*update*? `'.$???WhatEverField??[$i].'`
 ?ALLOWNULL?;';

 //mysql_query($sql);

 $result = mysql_query($sql) or die(br /br / Could not renumber dB $sql
 br /br / . mysql_error());


 $i++;
 endwhile;


 Thanks in advance

Hi,

The MySQL syntax to alter a column is:

ALTER TABLE `table` MODIFY `column` BIGINT NOT NULL;

[ http://dev.mysql.com/doc/refman/5.1/en/alter-table.html ]

The sql statement

SHOW COLUMNSFROM `table`;

[ http://dev.mysql.com/doc/refman/5.1/en/show-columns.html ]

will give you a list of all the fields with there type, default values, null 
etc...
You can then use this in the loop to find all the fields where null=NO.

Warning from the manual:

When you change a data type using CHANGE or MODIFY, MySQL tries to
convert existing column values to the new type as well as possible.

Warning
This conversion may result in alteration of data. For example, if you 
shorten a
string column, values may be truncated. To prevent the operation from
succeeding if conversions to the new data type would result in loss of 
data, enable
strict SQL mode before using ALTER TABLE (see Section 5.1.6, “SQL Modes”).

I don't think this will affect you but bare it in mind.

Regards

Ian
--



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread Mattias Thorslund

Jay Moore wrote:

revDAVE wrote:

Hi Folks,

Newbie question

I have a mysql table with 100 fields, currently all do not allow nulls.
Rather than hand typing in phpMyAdmin, I would like a way to loop 
through

all fields and update them to allow nulls


First I would DESCRIBE the table so you get a list of column names and 
attributes.  Then I would go thru each column and CHANGE it so it has 
the same attributes, adding the NULL flag if necessary.


There may be an easier way however.

Jay



I wouldn't bother mixing in PHP in all this.

In the mysql client, do a SHOW CREATE TABLE tableName\G

(The \G will save you from seeing lots of wrapping -'s)

Copy the returned CREATE TABLE statement, paste into your editor. Re-use 
the column definitions to craft the appropriate ALTER TABLE statement. 
Run in your mysql client, after testing on a copy of the table, or 
backup your data first, whichever is appropriate to your situation..


For a PHP solution, PEAR MDB2 (specifically the Manager and Reverse 
modules) could be used, but I would only use it for recurring situations 
where a generic solution is appropriate, not for a one-off operation 
like this seems to be.


Cheers,

Mattias

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread Chris Scott

 Hi Folks,
 
 Newbie question
 
 I have a mysql table with 100 fields, currently all do not allow nulls.
 Rather than hand typing in phpMyAdmin, I would like a way to loop through
 all fields and update them to allow nulls
 
 My Beginning attempt needs help...
 
 
 $i = 1;
 while ($i = 100):
 
 // how do I word this to just change whatever field we are on to allow
 nulls?
 
 $sql = 'ALTER TABLE `mytable` ?*update*? `'.$???WhatEverField??[$i].'`
 ?ALLOWNULL?;';
 
 //mysql_query($sql);
 
 $result = mysql_query($sql) or die(br /br / Could not renumber dB $sql
 br /br / . mysql_error());
 
 
 $i++;
 endwhile;
 
 
 Thanks in advance

Hi,

The MySQL syntax to alter a column is:

ALTER TABLE `table` MODIFY `column` BIGINT NOT NULL;

[ http://dev.mysql.com/doc/refman/5.1/en/alter-table.html ]

The sql statement

SHOW COLUMNSFROM `table`;

[ http://dev.mysql.com/doc/refman/5.1/en/show-columns.html ]

will give you a list of all the fields with there type, default values, null 
etc...
You can then use this in the loop to find all the fields where null=NO.

Warning from the manual:

When you change a data type using CHANGE or MODIFY, MySQL tries to 
convert existing column values to the new type as well as possible. 

Warning
This conversion may result in alteration of data. For example, if you 
 shorten a 
string column, values may be truncated. To prevent the operation from 
succeeding if conversions to the new data type would result in loss of 
 data, enable 
strict SQL mode before using ALTER TABLE (see Section 5.1.6, “SQL Modes”). 

I don't think this will affect you but bare it in mind.

Regards

Ian
-- 


You can also retrieve the field types with:

SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 
'whatever';

Which might help the programmatic approach.


Re: [PHP] Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread Andrew Ballard
On Tue, Jan 27, 2009 at 11:53 AM, revDAVE c...@hosting4days.com wrote:
 Hi Folks,

 Newbie question

 I have a mysql table with 100 fields, currently all do not allow nulls.
 Rather than hand typing in phpMyAdmin, I would like a way to loop through
 all fields and update them to allow nulls

 My Beginning attempt needs help...


 $i = 1;
 while ($i = 100):

 // how do I word this to just change whatever field we are on to allow
 nulls?

 $sql = 'ALTER TABLE `mytable` ?*update*? `'.$???WhatEverField??[$i].'`
 ?ALLOWNULL?;';

 //mysql_query($sql);

 $result = mysql_query($sql) or die(br /br / Could not renumber dB $sql
 br /br / . mysql_error());


$i++;
 endwhile;


 Thanks in advance



 --
 Thanks - RevDave
 Cool @ hosting4days . com
 [db-lists 09]


The other responses should get you started if this is something you
really want to do. However, I'll play devil's advocate here and just
raise the question why you would want to make this change in the first
place. I'm not quite as anti-NULL as a lot of arguments I've read
against them, but I tend to agree that the number of columns that
accept NULL values should be kept as small as possible. Even if you
decide that you need to allow NULL values in some cases, IMHO I
wouldn't write a script that ran through my entire database and opened
every column in every table to accept.

Just my 2 cents.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread Boyd, Todd M.
 -Original Message-
 From: Andrew Ballard [mailto:aball...@gmail.com]
 Sent: Tuesday, January 27, 2009 11:39 AM
 To: revDAVE
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Global Changes With Loop To Allow Nulls In A
 Table...
 
 On Tue, Jan 27, 2009 at 11:53 AM, revDAVE c...@hosting4days.com
 wrote:
  Hi Folks,
 
  Newbie question
 
  I have a mysql table with 100 fields, currently all do not allow
 nulls.
  Rather than hand typing in phpMyAdmin, I would like a way to loop
 through
  all fields and update them to allow nulls
 
  My Beginning attempt needs help...
 
 
  $i = 1;
  while ($i = 100):
 
  // how do I word this to just change whatever field we are on to
 allow
  nulls?
 
  $sql = 'ALTER TABLE `mytable` ?*update*?
 `'.$???WhatEverField??[$i].'`
  ?ALLOWNULL?;';
 
  //mysql_query($sql);
 
  $result = mysql_query($sql) or die(br /br / Could not renumber
 dB $sql
  br /br / . mysql_error());
 
 
 $i++;
  endwhile;
 
 
 The other responses should get you started if this is something you
 really want to do. However, I'll play devil's advocate here and just
 raise the question why you would want to make this change in the first
 place. I'm not quite as anti-NULL as a lot of arguments I've read
 against them, but I tend to agree that the number of columns that
 accept NULL values should be kept as small as possible. Even if you
 decide that you need to allow NULL values in some cases, IMHO I
 wouldn't write a script that ran through my entire database and opened
 every column in every table to accept.

I just thought I'd throw this out there...

A lot of people who post questions on this list are programming their 
algorithms and structuring their applications in a certain way because that's 
what the client wants, or that's what their boss told them to do. Yes, 
accepting NULL values in a database is frowned upon (unless the table is a 
transaction table)... but I doubt his boss or his client cares in the least.

My 2 cents. ;)


// Todd


[PHP] Empty $_REQUEST

2009-01-27 Thread Robert Paulsen
Hi,

I have a apache2/php app written for php version 4 and have moved it to a 
system running php version 5:

   Old: PHP 4.3.10
   New: PHP 5.2.6 with Suhosin-Patch 0.9.6.2

When I run the app I find that $_REQUEST is almost empty. it contains 
PHPSESSID but none of the data submitted through an html form.

/etc/php5/apache2/php.ini has both:

   variables_order = GPCS
   request_order = GPCS

(I added the 2nd line just to be sure.)

Is there something else that needs to be turned on to get form data into 
$_REQUEST?

An dd thing: If I issue phpinfo() before print_r($_REQUEST); then $_REQUEST 
does contain all my form data!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread Andrew Ballard
On Tue, Jan 27, 2009 at 12:58 PM, Boyd, Todd M. tmbo...@ccis.edu wrote:
 -Original Message-
 From: Andrew Ballard [mailto:aball...@gmail.com]
 Sent: Tuesday, January 27, 2009 11:39 AM
 To: revDAVE
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Global Changes With Loop To Allow Nulls In A
 Table...

 On Tue, Jan 27, 2009 at 11:53 AM, revDAVE c...@hosting4days.com
 wrote:
  Hi Folks,
 
  Newbie question
 
  I have a mysql table with 100 fields, currently all do not allow
 nulls.
  Rather than hand typing in phpMyAdmin, I would like a way to loop
 through
  all fields and update them to allow nulls
 
  My Beginning attempt needs help...
 
 
  $i = 1;
  while ($i = 100):
 
  // how do I word this to just change whatever field we are on to
 allow
  nulls?
 
  $sql = 'ALTER TABLE `mytable` ?*update*?
 `'.$???WhatEverField??[$i].'`
  ?ALLOWNULL?;';
 
  //mysql_query($sql);
 
  $result = mysql_query($sql) or die(br /br / Could not renumber
 dB $sql
  br /br / . mysql_error());
 
 
 $i++;
  endwhile;


 The other responses should get you started if this is something you
 really want to do. However, I'll play devil's advocate here and just
 raise the question why you would want to make this change in the first
 place. I'm not quite as anti-NULL as a lot of arguments I've read
 against them, but I tend to agree that the number of columns that
 accept NULL values should be kept as small as possible. Even if you
 decide that you need to allow NULL values in some cases, IMHO I
 wouldn't write a script that ran through my entire database and opened
 every column in every table to accept.

 I just thought I'd throw this out there...

 A lot of people who post questions on this list are programming their 
 algorithms and structuring their applications in a certain way because that's 
 what the client wants, or that's what their boss told them to do. Yes, 
 accepting NULL values in a database is frowned upon (unless the table is a 
 transaction table)... but I doubt his boss or his client cares in the least.

 My 2 cents. ;)


 // Todd


Understood. I just thought I'd raise the question since the OP is says
he is a PHP newbie (and based on his previous posts I'm guessing a
MySQL newbie as well, though I could be mistaken) just to make sure
the question (and its implications) has been at least considered
before making such a sweeping change.

FWIW, I would also be a little cautious about a client who asked me to
allow every column in every table accept NULLs.

Andrew

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Empty $_REQUEST

2009-01-27 Thread Daniel Brown
On Tue, Jan 27, 2009 at 13:12, Robert Paulsen rob...@paulsenonline.net wrote:

 When I run the app I find that $_REQUEST is almost empty. it contains
 PHPSESSID but none of the data submitted through an html form.

Bring on the code, Rob.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Coding for email response forms

2009-01-27 Thread Shawn McKenzie
Tom wrote:
 Edmund Hertle edmund.her...@student.kit.edu wrote in message 
 news:f7ed91b20901261644y125f71aer3e0b70735c949...@mail.gmail.com...
 2009/1/26 Tom obeli...@comcast.net

 Shawn McKenzie sh...@mckenzies.net wrote in message
 news:497e3ab9.2060...@mckenzies.net...

 Shawn McKenzie wrote:
 Tom Scott wrote:
 - Original Message - From: Shawn McKenzie
 nos...@mckenzies.net
 Newsgroups: php.general
 To: php-general@lists.php.net
 Sent: Monday, January 26, 2009 3:52 PM
 Subject: Re: [PHP] Coding for email response forms


 Tom wrote:
 Shawn McKenzie  wrote in message
 news:a0.87.62571.3d92e...@pb1.pair.com...
 Tom wrote:
 My Hosting site said that I needed to include the PHP otherwise
 the form
 won't work. I need to know where to include my email info to get
 this set
 up
 don't I? What do you suggest?
 T
 Daniel Brown danbr...@php.net wrote in message
 news:ab5568160901261259p6d6442a4ya5ea4134025e5...@mail.gmail.com.
 ..
 On Mon, Jan 26, 2009 at 15:57, Tom obeli...@comcast.net wrote:
 I am a new user of PHP, and am using Dreamweaver CS3 for the
 webpages.
 The
 following page has my form but the submit button is not working
 properly.
 http://www.richlandmtg.com/contacts.html
 What code is needed and where does it get placed in the page.? 
 I
 thought
 CS3
 took care of this.
Tom,

This issue has nothing at all to do with PHP.  This is all
 client
 side (JavaScript and HTML).

 --
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 Unadvertised dedicated server deals, too low to print - email me
 to find
 out!
 What you have now is a form that when submitted sends the data to
 itself.  So you either need to include some php in this file to
 gather
 up the data and email it when submitted, or submit to another file
 that
 does that.


 --
 Thanks!
 -Shawn
 http://www.spidean.com
 Shawn,
 So would that look something like this:
 ?
 if ($_SERVER['REQUEST_METHOD'] == POST) {

 // Just to be safe, I strip out HTML tags
 $realname = strip_tags($realname);
 $email = strip_tags($email);
 $feedback = strip_tags($feedback);

 // set the variables
 // replace $...@mysite.com with your email
 $sendto = $...@mysite.com;
 $subject = Sending Email Feedback From My Website;
 $message = $realname, $email\n\n$feedback;

 // send the email
 mail($sendto, $subject, $message);

 }
 ?



 Oh, you should also think about some other things, such as 
 validation.
 Is realname only alpha characters?  Is email in the form of a real
 email
 address?  At a bare minimum, are they not empty:

 if (empty($_POST['email']) ||
 empty($_POST['realname']) ||
 empty($_POST['feedback']))
 {
echo 'You must complete all required fields!';
 // show form again
 }


 --
 Thanks!
 -Shawn
 http://www.spidean.com
 Ok. I have the validation part.
 http://www.richlandmtg.com/index-5.html still working on the Send
 button.

 T


 Please reply all so this stays on the list.

 1.  In the source for your link I see that the JS is doing some
 validation.
 2.  You have method=get in your form.  This will work, but you'll 
 have
 to change the PHP code to use $_GET instead of $_POST vars.  Or change
 to method=post in the form.
 3.  If you want to keep the .html extension for the page, then you'll
 probably need to send the post to another script with a .php 
 extension.
 Normally a file with a .html extension won't execute the PHP code.

 Thanks!
 -Shawn



 I was just looking at that. Someone told me to use GET instead of POST.
 Since JS is validating is it as easy replacing GET with POST ? Nothing 
 else
 needed? Is it better to remove the JS and just code using PHP as you 
 showed
 before?
 if (empty($_POST['email']) ||
 empty($_POST['realname']) ||
 empty($_POST['feedback']))

 Thanks,
 Tom

 Yes, I think it is better to just use PHP code and post is the better 
 method
 (in this case) because with get all your fields and values will show up in
 the url

 -eddy

 I don't seem to be getting he hang of this. Sounds so simple but Can 
 someone check this out and tell me where exactly I'm messing up? 
 http://www.richlandmtg.com/Contact_Us.html
 I removed the JS validation. Is the following code ok?
 
 a href=# onClick=document.getElementById('form').reset()clear/aimg 
 alt= src=images/ch_more_red.gif   style=margin:1px 0 0 3px; 
 vertical-align:text-bottom/bb style=margin-left:17px;a href=# 
 onClick=document.getElementById('form').submit()send/a
 
 I posted the PHP info at the top of the page before the html tag. Should 
 it be after html?
 
 Sorry please bear with me,
 Tom 
 
 
Re-read point #3 from my last email.


-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Need Help resolving the undefined variable and getting property of non-object errors

2009-01-27 Thread Terion Miller
Hello All,
I am having problems resolving errors with some images causing the Undefined
variable and getting property of non-object errors, I am trying to make a
copy function so that an order can be viewed then resubmitted as a new order
with minimal changes if needed.
Here's my code: --could it be out of order as in the select should be above
the insert?  I bolded where the errors are happening.
---
?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
session_start();
include(inc/dbconn_open.php);


if (empty($_SESSION['AdminLogin']) || $_SESSION['AdminLogin'] !=  true){
header (Location: LogOut.php);
$_SESSION['user']=$UserName;
}
if (isset($_POST['AdminID'])){
$AdminID = $_POST['AdminID'];
} elseif (isset($_GET['AdminID'])){
$AdminID = $_GET['AdminID'];
} else {
header (Location: LogOut.php);
}

if (isset($_POST['WorkOrderID'])){
$WorkOrderID = $_POST['WorkOrderID'];
} elseif (isset($_GET['WorkOrderID'])){
$WorkOrderID = $_GET['WorkOrderID'];
} else {
header (Location: LogOut.php);
}

if (isset($_POST['ReturnPage'])){
$ReturnPage = $_POST['ReturnPage'];
} elseif (isset($_GET['ReturnPage'])){
$ReturnPage = $_GET['ReturnPage'];
} else {
$ReturnPage = Welcome.php;
}

if (!empty($_POST['GO'])){$GO = $_POST['GO'];} else {$GO = ;}
if (isset($_POST['Location'])){$Location = $_POST['Location'];} else
{$Location = ;}
if (isset($_POST['WorkOrderName'])){$WorkOrderName =
$_POST['WorkOrderName'];} else {$WorkOrderName = ;}
if (isset($_POST['IONumber'])){$IONumber = $_POST['IONumber'];} else
{$IONumber = ;}
if (isset ($_POST['AccountNum'])){$AccountNum = $_POST['AccountNum'];} else
{$AccountNum = ;}
if (!empty($_POST['BusinessName'])){$BusinessName = $_POST['BusinessName'];}
else {$BusinessName = ;}
if (!empty($_POST['URL'])){$URL = $_POST['URL'];} else {$URL = ;}
if (!empty($_POST['Address1'])){$Address1 = $_POST['Address1'];} else
{$Address1 = ;}
if (!empty($_POST['Address2'])){$Address2 = $_POST['Address2'];} else
{$Address2 = ;}
if (!empty($_POST['City'])){$City = $_POST['City'];} else {$City = ;}
if (!empty($_POST['State'])){$State = $_POST['State'];} else {$State = ;}
if (!empty($_POST['Zip'])){$Zip = $_POST['Zip'];} else {$Zip = ;}
if (!empty($_POST['Country'])){$Country = $_POST['Country'];} else {$Country
= ;}
if (!empty($_POST['Phone'])){$Phone = $_POST['Phone'];} else {$Phone = ;}
if (!empty($_POST['TollFree'])){$TollFree = $_POST['TollFree'];} else
{$TollFree = ;}
if (!empty($_POST['Fax'])){$Fax = $_POST['Fax'];} else {$Fax = ;}
if (!empty($_POST['Email'])){$Email = $_POST['Email'];} else {$Email = ;}
if (!empty($_POST['Tagline'])){$Tagline = $_POST['Tagline'];} else {$Tagline
= ;}
if (!empty($_POST['Established'])){$Established = $_POST['Established'];}
else {$Established = ;}
if (!empty($_POST['StartMonth'])  !empty($_POST['StartDay']) 
!empty($_POST['StartYear'])){
$StartDate = $_POST['StartYear'] .-. $_POST['StartMonth'] .-.
$_POST['StartDay'];
} else {
$StartDate = ;
}
if (!empty($_POST['EndMonth'])  !empty($_POST['EndDay']) 
!empty($_POST['EndYear'])){
$EndDate = $_POST['EndYear'] .-. $_POST['EndMonth'] .-.
$_POST['EndDay'];
} else {
$EndDate = ;
}
if (!empty($_POST['PackageType'])){$PackageType = $_POST['PackageType'];}
else {$PackageType = ;}
if (!empty($_POST['BusinessType'])){$BusinessType = $_POST['BusinessType'];}
else {$BusinessType = ;}
if (!empty($_POST['MondayOpen'])){$MondayOpen = $_POST['MondayOpen'];} else
{$MondayOpen = ;}
if (!empty($_POST['MondayClose'])){$MondayClose = $_POST['MondayClose'];}
else {$MondayClose = ;}
if (!empty($_POST['TuesdayOpen'])){$TuesdayOpen = $_POST['TuesdayOpen'];}
else {$TuesdayOpen = ;}
if (!empty($_POST['TuesdayClose'])){$TuesdayClose = $_POST['TuesdayClose'];}
else {$TuesdayClose = ;}
if (!empty($_POST['WednesdayOpen'])){$WednesdayOpen =
$_POST['WednesdayOpen'];} else {$WednesdayOpen = ;}
if (!empty($_POST['WednesdayClose'])){$WednesdayClose =
$_POST['WednesdayClose'];} else {$WednesdayClose = ;}
if (!empty($_POST['ThursdayOpen'])){$ThursdayOpen = $_POST['ThursdayOpen'];}
else {$ThursdayOpen = ;}
if (!empty($_POST['ThursdayClose'])){$ThursdayClose =
$_POST['ThursdayClose'];} else {$ThursdayClose = ;}
if (!empty($_POST['FridayOpen'])){$FridayOpen = $_POST['FridayOpen'];} else
{$FridayOpen = ;}
if (!empty($_POST['FridayClose'])){$FridayClose = $_POST['FridayClose'];}
else {$FridayClose = ;}
if (!empty($_POST['SaturdayOpen'])){$SaturdayOpen = $_POST['SaturdayOpen'];}
else {$SaturdayOpen = ;}
if (!empty($_POST['SaturdayClose'])){$SaturdayClose =
$_POST['SaturdayClose'];} else {$SaturdayClose = ;}
if (!empty($_POST['SundayOpen'])){$SundayOpen = $_POST['SundayOpen'];} else
{$SundayOpen = ;}
if (!empty($_POST['SundayClose'])){$SundayClose = $_POST['SundayClose'];}
else {$SundayClose = ;}
if (!empty($_POST['BusinessCat'])){$BusinessCat = $_POST['BusinessCat'];}
else {$BusinessCat = ;}
if 

Re: [PHP] Need Help resolving the undefined variable and getting property of non-object errors

2009-01-27 Thread Stuart
2009/1/27 Terion Miller webdev.ter...@gmail.com:
 I am having problems resolving errors with some images causing the Undefined
 variable and getting property of non-object errors, I am trying to make a
 copy function so that an order can be viewed then resubmitted as a new order
 with minimal changes if needed.
 Here's my code: --could it be out of order as in the select should be above
 the insert?  I bolded where the errors are happening.

Holy crap on a cracker, I'm not gonna read all that.

An undefined variable notice basically means you're trying to use a
variable before it's been given a value, so look for that on and
around the line it complains about and either display the variables or
trace them back to confirm they contain what you think they do.

The other error indicates that you're trying to use object notation
(-) on a scalar (number, string or array). Again, look at the line it
points you to and confirm the variables it contains have the values
you think they should.

This is basic debugging. Spending time resolving these errors yourself
is time well spent, and the more you do it the easier it becomes.

-Stuart

-- 
http://stut.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Need Help resolving the undefined variable and getting property of non-object errors

2009-01-27 Thread Shawn McKenzie
Terion Miller wrote:
 Hello All,
 I am having problems resolving errors with some images causing the Undefined
 variable and getting property of non-object errors, I am trying to make a
 copy function so that an order can be viewed then resubmitted as a new order
 with minimal changes if needed.
 Here's my code: --could it be out of order as in the select should be above
 the insert?  I bolded where the errors are happening.
 ---
 
 if ($GO == Save) {

echo $AdminID;

 $sql = SELECT Name FROM admin WHERE AdminID='$AdminID';
 $result = mysql_query ($sql);

echo mysql_num_rows($result);  //if 0 then $result is empty

* $row = mysql_fetch_object($result);this is giving me problems and I
 tried changing the object to assoc
 *
 $Notes = ~. date(F j, Y g:i a) . - Planet Discover Enhanced Listing
 Submitted by . $row-Name .\n;  *This is the trying to get property of
 non object*
 
-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Empty $_REQUEST

2009-01-27 Thread Robert Paulsen
On Tuesday 27 January 2009 12:16 pm, Daniel Brown wrote:
 On Tue, Jan 27, 2009 at 13:12, Robert Paulsen rob...@paulsenonline.net 
wrote:
  When I run the app I find that $_REQUEST is almost empty. it contains
  PHPSESSID but none of the data submitted through an html form.

 Bring on the code, Rob.


Daniel,

It is pretty much resolved. Thanks for the advice -- it was in trying to strip 
down my code for posting here that I figured out the following.

The immediate problem was that the code issued a header command to reawaken 
my web page and that is *supposed* to wipe out all my form data. The real 
problem to do with hashed md5 data I am keeping in the database (passwords) 
that are not matching what gets input on the form. Looking at $_REQUEST was a 
red herring that sent me astray.

In the code below, pg_num_rows came back with zero, saying the hashed password 
didn't match. And I could see by doing a manual query that they indeed didn't 
match. When I use php5 to asssign a new password, the above code correctly 
matched the newly hashed password. In other words it appears that md5 hashing 
doesn't agree between php4 and php5, but I am not in the mood for 
transferring data back and forth between the two systems to prove a point now 
that it is working for me (with no code change).

Here is the code in question, in case you spot anything wrong with it.
==

$passwd=htmlentities($passwd,ENT_QUOTES);
$query=SELECT md5('$passwd') as hashed;
$result=issue_query($query);
$row=pg_fetch_assoc($result);
$hashed=$row['hashed'];

$query=SELECT * from auth
WHERE userid='$userid'
AND passwd='$hashed';
$result=issue_query($query);
if (pg_num_rows($result)==0) {
$_SESSION['status']='bad';
header(location: $PHP_SELF);
exit ;
}
===

Bob


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Empty $_REQUEST

2009-01-27 Thread Alpár Török
2009/1/27 Robert Paulsen rob...@paulsenonline.net

 On Tuesday 27 January 2009 12:16 pm, Daniel Brown wrote:
  On Tue, Jan 27, 2009 at 13:12, Robert Paulsen rob...@paulsenonline.net
 wrote:
   When I run the app I find that $_REQUEST is almost empty. it contains
   PHPSESSID but none of the data submitted through an html form.
 
  Bring on the code, Rob.


 Daniel,

 It is pretty much resolved. Thanks for the advice -- it was in trying to
 strip
 down my code for posting here that I figured out the following.

 The immediate problem was that the code issued a header command to
 reawaken
 my web page and that is *supposed* to wipe out all my form data. The real
 problem to do with hashed md5 data I am keeping in the database (passwords)
 that are not matching what gets input on the form. Looking at $_REQUEST was
 a
 red herring that sent me astray.

 In the code below, pg_num_rows came back with zero, saying the hashed
 password
 didn't match. And I could see by doing a manual query that they indeed
 didn't
 match. When I use php5 to asssign a new password, the above code correctly
 matched the newly hashed password. In other words it appears that md5
 hashing
 doesn't agree between php4 and php5, but I am not in the mood for
 transferring data back and forth between the two systems to prove a point
 now
 that it is working for me (with no code change).

 Here is the code in question, in case you spot anything wrong with it.
 ==

$passwd=htmlentities($passwd,ENT_QUOTES);
$query=SELECT md5('$passwd') as hashed;
$result=issue_query($query);
$row=pg_fetch_assoc($result);
$hashed=$row['hashed'];

$query=SELECT * from auth
WHERE userid='$userid'
AND passwd='$hashed';
$result=issue_query($query);
if (pg_num_rows($result)==0) {
$_SESSION['status']='bad';
header(location: $PHP_SELF);
exit ;
}
 ===

why don't you just use phps md5() function ? you might mess up something in
that process of hashing that  you use and  you create another, probably
useless trip to the db.



 Bob


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Alpar Torok


Re: [PHP] Empty $_REQUEST

2009-01-27 Thread Robert Paulsen
On Tuesday 27 January 2009 2:13 pm, Alpár Török wrote:

 why don't you just use phps md5() function ? you might mess up something in
 that process of hashing that  you use and  you create another, probably
 useless trip to the db.


I just don't know any better! I'll look it up.

Thanks,
Bob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Re : [PHP] profiler web server

2009-01-27 Thread Jim Lucas
djamel boussebha wrote:
 Hi Jim;
 
 My question is : if you have a server where is installed : apache2 + PHP5 and 
 if you execute of load/stress tests on this server = Except the system 
 resources of the server (CPU, RAM, ..), which are other component to watch 
 (for example the size of the process httpd).
 

Is this a *nix style system?

If so, you can use the top and ps commands to see the various system resources 
in use by different processes.

using top is simple, just type top and look at the SIZE and RES columns.  These 
will tell you how much RAM is being used.

Then using ps I run the following command

ps aux


If you are running windows, then I'm not sure what you can use.

I use a program call Secure Task Manager.  I'm sure there are better programs.  
But have never looked for them.


 Regards;
 
 
 
 
 De : Jim Lucas li...@cmsws.com
 À : soussou97 dbousse...@yahoo.fr
 Cc : php-gene...@lists..php.net
 Envoyé le : Lundi, 26 Janvier 2009, 16h48mn 19s
 Objet : Re: [PHP] profiler web server
 
 soussou97 wrote:
 Hi;

 I have a web server (apache 2.2 + PHP5) which process must be watched for
 measuring the perf ?

 Regards;
 
 All I see here is a statement..  Do you actually have a question for us?
 

-- 
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] Empty $_REQUEST

2009-01-27 Thread Alpár Török
2009/1/27 Robert Paulsen rob...@paulsenonline.net

 On Tuesday 27 January 2009 2:13 pm, Alpár Török wrote:

  why don't you just use phps md5() function ? you might mess up something
 in
  that process of hashing that  you use and  you create another, probably
  useless trip to the db.
 

 I just don't know any better! I'll look it up.

php has an md5 function built in. so you can jsut do

$hash = md5($passwd);
and use that in the query that checks if the password is correct;



 Thanks,
 Bob

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Alpar Torok


[PHP] php forking/spawning question...

2009-01-27 Thread bruce
Hi...

got the follwoing example... basically, when i call the function spawn_ i
get the passed vars for appname/args...

the $appname,$args are valid when the spawn_ function is initially invoked.
however, when the app does the fork, the $appname, $args get lost. when the
function gets to the pcntl_exec, the vars ($appname, $args) are no longer
set.

so what did i miss, how is this process supposed to work?

thoughts/comments...

thanks


=
/*
test func to spawn client thread
*/
function spawn_($appname, $args)
{
print appname =.$appname.\n;
print_r($args);
//exit();

$pid = pcntl_fork();
if ($pid == -1)
{
die('cannot fork');
}
elseif ($pid)
{
print child pid = .$pid.\n;
//pcntl_waitpid($pid, $status);
//break;
//exit();
$par=1;
}
else
{
// Note that pcntl_exec() automatically prepends the program
name
// to the array of arguments; the program name cannot be
spoofed.
print running cmd \n;
 pcntl_exec($appname, $args);
//system(./clientmgr.php);
 exit();
}
}



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Empty $_REQUEST

2009-01-27 Thread Jim Lucas
Robert Paulsen wrote:
 On Tuesday 27 January 2009 12:16 pm, Daniel Brown wrote:
 On Tue, Jan 27, 2009 at 13:12, Robert Paulsen rob...@paulsenonline.net 
 wrote:
 When I run the app I find that $_REQUEST is almost empty. it contains
 PHPSESSID but none of the data submitted through an html form.
 Bring on the code, Rob.
 
 
 Daniel,
 
 It is pretty much resolved. Thanks for the advice -- it was in trying to 
 strip 
 down my code for posting here that I figured out the following.
 
 The immediate problem was that the code issued a header command to reawaken 
 my web page and that is *supposed* to wipe out all my form data. The real 
 problem to do with hashed md5 data I am keeping in the database (passwords) 
 that are not matching what gets input on the form. Looking at $_REQUEST was a 
 red herring that sent me astray.
 
 In the code below, pg_num_rows came back with zero, saying the hashed 
 password 
 didn't match. And I could see by doing a manual query that they indeed didn't 
 match. When I use php5 to asssign a new password, the above code correctly 
 matched the newly hashed password. In other words it appears that md5 hashing 
 doesn't agree between php4 and php5, but I am not in the mood for 
 transferring data back and forth between the two systems to prove a point now 
 that it is working for me (with no code change).
 
 Here is the code in question, in case you spot anything wrong with it.
 ==
 
 $passwd=htmlentities($passwd,ENT_QUOTES);



 $query=SELECT md5('$passwd') as hashed;
 $result=issue_query($query);
 $row=pg_fetch_assoc($result);
 $hashed=$row['hashed'];
 

Move the previous code into the following code.


 $query=SELECT * from auth
 WHERE userid='$userid'
 AND passwd='$hashed';

Change that last line to this:

AND passwd=md5('{$passwd}');


 $result=issue_query($query);
 if (pg_num_rows($result)==0) {
 $_SESSION['status']='bad';
 header(location: $PHP_SELF);
 exit ;
 }
 ===
 
 Bob
 
 


-- 
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] Empty $_REQUEST

2009-01-27 Thread Robert Paulsen
On Tuesday 27 January 2009 2:25 pm, Alpár Török wrote:

 php has an md5 function built in. so you can jsut do

 $hash = md5($passwd);

Works like a champ. Thanks.

Bob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Make New-Age Money Online with Google

2009-01-27 Thread Frank Stanovcak

Martin Zvarík mzva...@gmail.com wrote in message 
news:66.93.12464.913ee...@pb1.pair.com...
 Ashley Sheridan napsal(a):
 On Sat, 2009-01-24 at 10:14 +0200, Dora Elless wrote:
 That's why I am sending this email only to people I know and care
 about.
 And they send to a mailing list. Come again?


 Ash
 www.ashleysheridan.co.uk


 The sad thing though is that there will be always people who believe this 
 shit and pays...

 Like my dad bought a little book Take off your glasses for $10 and he 
 received 2 papers saying: sun is our best friend, look right into it and 
 it will heal your eyes.
just like that little pile of plutonium in my back yard is great for warming 
your butt on...Have a seat!

ATTENTION SHORT SITED, HUMORLESS, MORONS IN THE GOVT...that should cover 
everyone...THIS IS A JOKE.  I DO NOT OWN...
1. A YARD
2. A HOUSE FOR THE YARD I DON'T OWN
3. ANY RADIOLOGICAL MATERIALS
4. A SINGLE FRICKING THING REALLY SINCE YOU TAX MOST OF IT OUT OF ME 
ALREADY!
 NOW GO FIND SOMETHING MORE USEFULL TO DO WITH ALL MY TAX DOLLARS!

frank. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: New PHP User with a simple question

2009-01-27 Thread Frank Stanovcak

Paul M Foster pa...@quillandmouse.com wrote in message 
news:20090126222404.gc18...@quillandmouse.com...
 On Mon, Jan 19, 2009 at 04:45:08PM -0500, Christopher W wrote:

 Dear responders,

 I was not sure which post was the best to respond to all of you so I 
 chose
 the original.

 I wanted to thank you all for taking the time to try and help answer my
 question.  I truly appreciate it.

 For the record, I have a PHP book and I understand (I think) all the
 variables, functions, conditionals, loops, constants, etc. of PHP.  My
 problem, with no computer programming to speak of, was putting those
 variables, functions, conditionals, loops, constants, etc. together to 
 make
 it do things I was hoping to accomplish.  I am hoping that with reading 
 more
 tutorials, looking at other people's php files and lots of practicing I 
 may
 one day get it.

 I am truly grateful for all the time all of you spent in trying to help.

 Glad you found a solution (from Kevin).

 Don't worry about the sniping on the list. A lot of programmer types can
 get prickly with each other about details.

 Paul
 -- 
 Paul M. Foster

Paul...leave Ash alone. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Get Money Fast with the Government Grants

2009-01-27 Thread Frank Stanovcak

Andrew Williams andrew4willi...@gmail.com wrote in message 
news:1adf0c280901270134o2f06d0f9kaf3fce2fb4b6c...@mail.gmail.com...
 Hi,
 Beware of he spam mailer so do not let them spam your money away.

 Andrew

 On Tue, Jan 27, 2009 at 9:18 AM, clive 
 clive_li...@immigrationunit.comwrote:

 Dora Gaskins wrote:

 If you have received this email, take a time to really read it 
 carefully!

 American Gov Money

 More spam, can't we have the maillist software require people to register
 before posting?


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




 -- 

 Best Wishes
 Andrew Williams
 ---
 31 Davies Street
 W1K 4LP, London, UK
 www.NetPosten.dk


OK peeps...who's machine has a cold?

Frank
fancy sig thing here 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread Chris



The other responses should get you started if this is something you
really want to do. However, I'll play devil's advocate here and just
raise the question why you would want to make this change in the first
place. I'm not quite as anti-NULL as a lot of arguments I've read
against them, but I tend to agree that the number of columns that
accept NULL values should be kept as small as possible. Even if you
decide that you need to allow NULL values in some cases, IMHO I
wouldn't write a script that ran through my entire database and opened
every column in every table to accept.


I just thought I'd throw this out there...

A lot of people who post questions on this list are programming their 
algorithms and structuring their applications in a certain way because that's 
what the client wants, or that's what their boss told them to do. Yes, 
accepting NULL values in a database is frowned upon (unless the table is a 
transaction table)... but I doubt his boss or his client cares in the least.


I don't understand what you mean about a transaction table - you 
should only use nulls if you understand what they do and why you'd need 
them in that particular case. I'd ask why and find specifically what 
they want/why they suggested it and make sure they understand the 
repercussions.


--
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] Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread Boyd, Todd M.
 -Original Message-
 From: Chris [mailto:dmag...@gmail.com]
 Sent: Tuesday, January 27, 2009 4:04 PM
 To: Boyd, Todd M.
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Global Changes With Loop To Allow Nulls In A
 Table...
 
 
  The other responses should get you started if this is something you
  really want to do. However, I'll play devil's advocate here and just
  raise the question why you would want to make this change in the
 first
  place. I'm not quite as anti-NULL as a lot of arguments I've read
  against them, but I tend to agree that the number of columns that
  accept NULL values should be kept as small as possible. Even if you
  decide that you need to allow NULL values in some cases, IMHO I
  wouldn't write a script that ran through my entire database and
 opened
  every column in every table to accept.
 
  I just thought I'd throw this out there...
 
  A lot of people who post questions on this list are programming their
 algorithms and structuring their applications in a certain way because
 that's what the client wants, or that's what their boss told them to
 do. Yes, accepting NULL values in a database is frowned upon (unless
 the table is a transaction table)... but I doubt his boss or his client
 cares in the least.
 
 I don't understand what you mean about a transaction table - you
 should only use nulls if you understand what they do and why you'd need
 them in that particular case. I'd ask why and find specifically what
 they want/why they suggested it and make sure they understand the
 repercussions.

A transaction table -- a table that is used to house the state of a 
transaction. If the transaction is incomplete, some of its values will be NULL. 
This is, of course, only one method for employing a transaction system. There 
exist others that use many disparate tables for separate steps in the 
transaction, but I've seen several that use one table with NULL columns for 
steps that haven't yet been processed.


// Todd


Re: [PHP] Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread Chris

Boyd, Todd M. wrote:

-Original Message-
From: Chris [mailto:dmag...@gmail.com]
Sent: Tuesday, January 27, 2009 4:04 PM
To: Boyd, Todd M.
Cc: php-general@lists.php.net
Subject: Re: [PHP] Global Changes With Loop To Allow Nulls In A
Table...



The other responses should get you started if this is something you
really want to do. However, I'll play devil's advocate here and just
raise the question why you would want to make this change in the

first

place. I'm not quite as anti-NULL as a lot of arguments I've read
against them, but I tend to agree that the number of columns that
accept NULL values should be kept as small as possible. Even if you
decide that you need to allow NULL values in some cases, IMHO I
wouldn't write a script that ran through my entire database and

opened

every column in every table to accept.

I just thought I'd throw this out there...

A lot of people who post questions on this list are programming their

algorithms and structuring their applications in a certain way because
that's what the client wants, or that's what their boss told them to
do. Yes, accepting NULL values in a database is frowned upon (unless
the table is a transaction table)... but I doubt his boss or his client
cares in the least.

I don't understand what you mean about a transaction table - you
should only use nulls if you understand what they do and why you'd need
them in that particular case. I'd ask why and find specifically what
they want/why they suggested it and make sure they understand the
repercussions.


A transaction table -- a table that is used to house the state of a 
transaction. If the transaction is incomplete, some of its values will be NULL. 
This is, of course, only one method for employing a transaction system. There 
exist others that use many disparate tables for separate steps in the 
transaction, but I've seen several that use one table with NULL columns for 
steps that haven't yet been processed.


Ah like a queue processing table? I understand what you mean now :)

--
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] php forking/spawning question...

2009-01-27 Thread Chris

bruce wrote:

Hi...

got the follwoing example... basically, when i call the function spawn_ i
get the passed vars for appname/args...

the $appname,$args are valid when the spawn_ function is initially invoked.
however, when the app does the fork, the $appname, $args get lost. when the
function gets to the pcntl_exec, the vars ($appname, $args) are no longer
set.


Was that the whole script or was there extra stuff you took out?

My only suggestion would be to add:

echo At line  . __LINE__ .  appname is ' . $appname . '\n;

type messages every 10-20 lines and see where it disappears.

Maybe you're overwriting the variables somewhere.

--
Postgresql  php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Programming general question

2009-01-27 Thread Terion Miller
I googled this and didn't find an answer 
my question is how do you know when to use an object or array

would an object just be 1 instance, and array is several things together ( I
know infantile coder language I use..but I'm a baby still in this)

Can someone explain objects and arrays in plain speak for me?
Thanks
Happy Coding


[PHP] [PROJECT HELP] - JotBug - A Project Management Issue Tracker written 100% with Zend Framework

2009-01-27 Thread rcastley

Hi,
 
I am looking (begging!) for help/testing/feedback etc etc etc on my JotBug
project
 
http://jotbug.googlecode.com
 
So far, I have the following implemented:
 
Wiki
 - Syntax is Textile
 - Add
 - Edit
 - Preview
 - Delete
 - Attachments (upload/view)
 - Code highlighting using Geshi
 - Macro Plugins
 
Tracker
 - Add
 - List
 - View
 
Authentication
 - Dummy Login
 
SCM
 - SVN browser
 - SVN viewer - code highlighting using GeSHi
 
Mutiple Project Listing
 
I am working on e-mail notification and user profile/account settings at the
moment.
 
Thanks in advance.
 
- Robert
-- 
View this message in context: 
http://www.nabble.com/-PROJECT-HELPJotBug---A-Project-Management---Issue-Tracker-written-100--with-Zend-Framework-tp21696826p21696826.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] Hidden costs of PHP arrays?

2009-01-27 Thread Clancy
PHP arrays permit extremely concise programming; for example if I have all my 
contacts in
an array $contacts, I can write:

$my_phone_no = $contacts['clancy']['phone'];

However it is clear that there must be a lot going on behind the scenes to 
achieve this
simple result, as it requires some sort of search procedure.

Is it possible to give any indication of the overheads and memory costs that 
are involved
in such a statement, and of how well the search procedure is implemented?

Also what the relative virtues of defining the same set of fields for every 
contact, as
against either defining only the fields which actually hold values, as in the 
following
examples?

a:
$contacts['clancy']['home_address'] = 'jkjkjk';
$contacts['clancy']['home_phone'] = 0123 4567;
$contacts['clancy'][' office_address''] = '';
$contacts['clancy']['office_phone'] = '';
$contacts['joe']['home_address'] = '';
$contacts['joe']['home_phone'] = '';
$contacts['joe']['office_address'] = 'jsfvkl';
$contacts['joe']['office_phone'] = 'jsfvkl';

b;
$contacts['clancy']['home_phone'] = 0123 4567;
$contacts['clancy']['home_address'] = 'jkjkjk';
$contacts['joe']['office_address'] = 'jsfvkl';
$contacts['joe']['office_phone'] = 'jsfvkl';

And is there any advantage in always assigning the keys in the same order?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Programming general question

2009-01-27 Thread Edmund Hertle
2009/1/28 Terion Miller webdev.ter...@gmail.com

 I googled this and didn't find an answer 
 my question is how do you know when to use an object or array

 would an object just be 1 instance, and array is several things together (
 I
 know infantile coder language I use..but I'm a baby still in this)

 Can someone explain objects and arrays in plain speak for me?
 Thanks
 Happy Coding


Hey,

Arrays: A structure to store data
Example:
$example = array(value1, value2, value3);
echo $example[0]; // echos value1
echo $example[2]; // echos value3

Object: Something totally diffrent. A object is an instance of a class.
Contains variables and methods.

I don't know how you thought of using arrays or objects for the same
problem? Can you give an example?

Try this for arrays: http://de2.php.net/manual/en/language.types.array.php
You should look for object-oriented programming to understand what an
object is
Then you will get help here:
http://de2.php.net/manual/en/language.oop5.basic.php

-eddy


Re: [PHP] Re: Doc standard for methods?

2009-01-27 Thread Nathan Rixham

Kyle Terry wrote:

On Tue, Jan 27, 2009 at 7:06 AM, Eric Butera eric.but...@gmail.com wrote:

On Tue, Jan 27, 2009 at 10:00 AM, Kyle Terry k...@kyleterry.com wrote:

On Tue, Jan 27, 2009 at 5:56 AM, Nathan Rixham nrix...@gmail.com wrote:

Larry Garfield wrote:

Greetings, all.  I am looking for feedback on a documentation question, in
the hopes that someone else has found a good solution to an abnormal
situation.

We're in the process of introducing OOP syntax to a large procedural code
base.  Our developer base is a mixture of people who are procedural-centric
and those that flip between procedural and OOP easily.  One area we've run
into is documenting some of the more complex OOP interactions.  For example,
if we have a method chain:

foo()-bar()-baz()-narf();

some developers have expressed concern in figuring out which narf() method
is actually being called, since foo(), bar() and baz() may return objects of
different classes (of the same interface) depending on various conditions
(the classic factory pattern).
Currently, we're including a docblock (Doxygen, close enough to PHPDoc for
government work) on the interface or parent class that has full docs, and
then nothing on the child classes.  My understanding of docblocks is that
most documentation parsers prefer that, so that the docblock itself
inherits.
One suggestion that has been raised is to reference the parent class and
factory function in a comment after the method signature.  That is:

class Narfing_mysql {
 // ...

 public function narf() { // Narfing  foo()
   // ...
 }
}

So that it can be easily grepped for.  That strikes me as a very hacky
non-
solution.  Does anyone else have a recommendation for how to improve such
documentation?  Is there a standard in PHPDoc that I don't know about?  Any
other projects doing something like that?



first idea would just be to use the @return; if they're using any kind
decent of ide it'll show the return type; failing that they can check the
docs

class Narfing_mysql {
 /**
 *
 * @return Type
 */
 public function narf() { // Narfing  foo()
   // ...
 }
}

or not best practice but i dare say

class Narfing_mysql {
 /**
 *
 * @return TypeA, TypeB
 */
 public function narf() { // Narfing  foo()
   // ...
 }
}

or in the method description with @see Class inline links?

regards

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Eric and I were just discussing something similar yesterday. We
discovered you can make private and protected method calls from two
different instances of the same object type. I personally called this
reference hopping.

--
Kyle Terry | www.kyleterry.com
Help kick start VOOM (Very Open Object Model) for a library of PHP classes.
http://www.voom.me | IRC EFNet #voom

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



And I called it haxx. ;)



Never said we used it :) Remember my coworkers responce ... FNE!



and I want to know more, do you mean..

class egg {

 private function whatever()
 {
   echo __METHOD__ . PHP_EOL;
 }

 protected function wherever( $e )
 {
  $e-whatever();
 }

 public function whenever( $e ) {
  $this-wherever($e);
 }
}

$a = new egg;
$b = new egg;
$a-whenever($b);

??

regards!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Hidden costs of PHP arrays?

2009-01-27 Thread Edmund Hertle
2009/1/28 Clancy clanc...@cybec.com.au

 PHP arrays permit extremely concise programming; for example if I have all
 my contacts in
 an array $contacts, I can write:

 $my_phone_no = $contacts['clancy']['phone'];

 However it is clear that there must be a lot going on behind the scenes to
 achieve this
 simple result, as it requires some sort of search procedure.

 Is it possible to give any indication of the overheads and memory costs
 that are involved
 in such a statement, and of how well the search procedure is implemented?

 Also what the relative virtues of defining the same set of fields for every
 contact, as
 against either defining only the fields which actually hold values, as in
 the following
 examples?

 a:
 $contacts['clancy']['home_address'] = 'jkjkjk';
 $contacts['clancy']['home_phone'] = 0123 4567;
 $contacts['clancy'][' office_address''] = '';
 $contacts['clancy']['office_phone'] = '';
 $contacts['joe']['home_address'] = '';
 $contacts['joe']['home_phone'] = '';
 $contacts['joe']['office_address'] = 'jsfvkl';
 $contacts['joe']['office_phone'] = 'jsfvkl';

 b;
 $contacts['clancy']['home_phone'] = 0123 4567;
 $contacts['clancy']['home_address'] = 'jkjkjk';
 $contacts['joe']['office_address'] = 'jsfvkl';
 $contacts['joe']['office_phone'] = 'jsfvkl';

 And is there any advantage in always assigning the keys in the same order?


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


Well, arrays of those types are, as far as I know, stored as hash tables. So
you should look for how hash tables work.

-eddy


[PHP] Re: Hidden costs of PHP arrays?

2009-01-27 Thread Nathan Rixham

Clancy wrote:

Also what the relative virtues of defining the same set of fields for every 
contact, as
against either defining only the fields which actually hold values, as in the 
following
examples?

a:
$contacts['clancy']['home_address'] = 'jkjkjk';
$contacts['clancy']['home_phone'] = 0123 4567;
$contacts['clancy'][' office_address''] = '';
$contacts['clancy']['office_phone'] = '';
$contacts['joe']['home_address'] = '';
$contacts['joe']['home_phone'] = '';
$contacts['joe']['office_address'] = 'jsfvkl';
$contacts['joe']['office_phone'] = 'jsfvkl';

b;
$contacts['clancy']['home_phone'] = 0123 4567;
$contacts['clancy']['home_address'] = 'jkjkjk';
$contacts['joe']['office_address'] = 'jsfvkl';
$contacts['joe']['office_phone'] = 'jsfvkl';



if you go for option b; you're going to have do a vast amount of isset() 
checks in a for loop and all kinds of fancy business logic for


$contacts['clancy']['home_phone'] = 0123 4567;
vs
$contacts['clancy']['home_phone'] = '';
vs
'home_phone' not set

so one would guess that code would far outweigh any tiny speed gain from 
dropping the additional items in the array.


on another note; php has been stable and speedy now for a very long 
time, some bit's like the reflection api could be speeded up a little 
bit as demand grows, but certainly all scalars and compound types have 
been tested and optimized to hell and back (afaik).


you can test this all you're self, simply populate an array with say 
1000 random other arrays of data with 10 keys each, stick it in a for 
loop and time several times, then do the same for an array as above but 
with subarrays of only 5 keys; see if you can spot any significant 
difference. [then compare to say a single database select, or an 
execution of a small script.]


another way of putting it; I'm 99% sure that nobodies code is perfectly 
optimised enough by itself to notice any performance hits from php; 
quite sure you could make far bigger gains by optimising you're own code 
first :p


regards! ramble

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Programming general question

2009-01-27 Thread Robert Cummings
On Wed, 2009-01-28 at 01:07 +0100, Edmund Hertle wrote:
 2009/1/28 Terion Miller webdev.ter...@gmail.com
 
  I googled this and didn't find an answer 
  my question is how do you know when to use an object or array
 
  would an object just be 1 instance, and array is several things together (
  I
  know infantile coder language I use..but I'm a baby still in this)
 
  Can someone explain objects and arrays in plain speak for me?
  Thanks
  Happy Coding
 
 
 Hey,
 
 Arrays: A structure to store data
 Example:
 $example = array(value1, value2, value3);
 echo $example[0]; // echos value1
 echo $example[2]; // echos value3
 
 Object: Something totally diffrent. A object is an instance of a class.
 Contains variables and methods.
 
 I don't know how you thought of using arrays or objects for the same
 problem? Can you give an example?

An array's functionality can be implemented as a Class with specific
array instances being Objects. This allows the array to be used in
polymorphic contexts and to be extended by subclasses. The same can be
said for any primitive datatype.

Personally, I haven't seen a need to use an Array class in PHP. That's
not to say it doesn't have a purpose, but I lean towards primitives when
possible for efficiency.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Hidden costs of PHP arrays?

2009-01-27 Thread Robert Cummings
On Wed, 2009-01-28 at 10:38 +1100, Clancy wrote:
 PHP arrays permit extremely concise programming; for example if I have all my 
 contacts in
 an array $contacts, I can write:
 
 $my_phone_no = $contacts['clancy']['phone'];
 
 However it is clear that there must be a lot going on behind the scenes to 
 achieve this
 simple result, as it requires some sort of search procedure.
 
 Is it possible to give any indication of the overheads and memory costs that 
 are involved
 in such a statement, and of how well the search procedure is implemented?
 
 Also what the relative virtues of defining the same set of fields for every 
 contact, as
 against either defining only the fields which actually hold values, as in the 
 following
 examples?
 
 a:
 $contacts['clancy']['home_address'] = 'jkjkjk';
 $contacts['clancy']['home_phone'] = 0123 4567;
 $contacts['clancy'][' office_address''] = '';
 $contacts['clancy']['office_phone'] = '';
 $contacts['joe']['home_address'] = '';
 $contacts['joe']['home_phone'] = '';
 $contacts['joe']['office_address'] = 'jsfvkl';
 $contacts['joe']['office_phone'] = 'jsfvkl';
 
 b;
 $contacts['clancy']['home_phone'] = 0123 4567;
 $contacts['clancy']['home_address'] = 'jkjkjk';
 $contacts['joe']['office_address'] = 'jsfvkl';
 $contacts['joe']['office_phone'] = 'jsfvkl';
 
 And is there any advantage in always assigning the keys in the same order?

Lookup is O( lg n ). Since your examples above are nested 2 levels deep
then it's actually 2 * O( lg n ) which is O( lg n ). But really, the
variable itself, $contacts is probably also looked up and it is also
O( lg n ) and of course 3 * O( lg n ) is still O( lg n ). Moving
along... for arbitrary depth paths, you'd be talking O( m lg n ) but for
realistic cases you'll not get deep enough for that to matter much.
Either way, if you are looping over an array and always accessing X
levels deep, you might want to create a temporary variable that is level
X - 1 (unless that's not a possible option).

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Programming general question

2009-01-27 Thread Nathan Rixham

Robert Cummings wrote:

On Wed, 2009-01-28 at 01:07 +0100, Edmund Hertle wrote:

2009/1/28 Terion Miller webdev.ter...@gmail.com


I googled this and didn't find an answer 
my question is how do you know when to use an object or array

would an object just be 1 instance, and array is several things together (
I
know infantile coder language I use..but I'm a baby still in this)

Can someone explain objects and arrays in plain speak for me?
Thanks
Happy Coding


Hey,

Arrays: A structure to store data
Example:
$example = array(value1, value2, value3);
echo $example[0]; // echos value1
echo $example[2]; // echos value3

Object: Something totally diffrent. A object is an instance of a class.
Contains variables and methods.

I don't know how you thought of using arrays or objects for the same
problem? Can you give an example?


An array's functionality can be implemented as a Class with specific
array instances being Objects. This allows the array to be used in
polymorphic contexts and to be extended by subclasses. The same can be
said for any primitive datatype.

Personally, I haven't seen a need to use an Array class in PHP. That's
not to say it doesn't have a purpose, but I lean towards primitives when
possible for efficiency.

Cheers,
Rob.


ahh i said the same until recently, and it's actually prompted me to 
start making some generic container classes with array accessors.


simple example being, I want an array which can't have duplicates and 
doesn't have any kind of ordered indexing, just an array or container i 
can throw objects in and trust that i won't have any dups. Another 
example is if you want an array of objects which can only be of 
class/interface type x




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Hidden costs of PHP arrays?

2009-01-27 Thread Nathan Rixham

Robert Cummings wrote:

On Wed, 2009-01-28 at 10:38 +1100, Clancy wrote:

PHP arrays permit extremely concise programming; for example if I have all my 
contacts in
an array $contacts, I can write:

$my_phone_no = $contacts['clancy']['phone'];

However it is clear that there must be a lot going on behind the scenes to 
achieve this
simple result, as it requires some sort of search procedure.

Is it possible to give any indication of the overheads and memory costs that 
are involved
in such a statement, and of how well the search procedure is implemented?

Also what the relative virtues of defining the same set of fields for every 
contact, as
against either defining only the fields which actually hold values, as in the 
following
examples?

a:
$contacts['clancy']['home_address'] = 'jkjkjk';
$contacts['clancy']['home_phone'] = 0123 4567;
$contacts['clancy'][' office_address''] = '';
$contacts['clancy']['office_phone'] = '';
$contacts['joe']['home_address'] = '';
$contacts['joe']['home_phone'] = '';
$contacts['joe']['office_address'] = 'jsfvkl';
$contacts['joe']['office_phone'] = 'jsfvkl';

b;
$contacts['clancy']['home_phone'] = 0123 4567;
$contacts['clancy']['home_address'] = 'jkjkjk';
$contacts['joe']['office_address'] = 'jsfvkl';
$contacts['joe']['office_phone'] = 'jsfvkl';

And is there any advantage in always assigning the keys in the same order?


Lookup is O( lg n ). Since your examples above are nested 2 levels deep
then it's actually 2 * O( lg n ) which is O( lg n ). But really, the
variable itself, $contacts is probably also looked up and it is also
O( lg n ) and of course 3 * O( lg n ) is still O( lg n ). Moving
along... for arbitrary depth paths, you'd be talking O( m lg n ) but for
realistic cases you'll not get deep enough for that to matter much.
Either way, if you are looping over an array and always accessing X
levels deep, you might want to create a temporary variable that is level
X - 1 (unless that's not a possible option).

Cheers,
Rob.


rob; go apply for a job at yahoo - that's one of there interview 
questions for new developers [describe o notation]


is impressed - v nice answer

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Installation of php-5.2.8-win32-installer.msi

2009-01-27 Thread Jerry Foote
Tried to install PHP using this installer and about 2/3 of the way through
the installation I get an error message:

 



 

I am trying to install the IIS ISAPI module and MySQL to the hard drive
under c:\Program Files\PHP on an XP Professional SP2 machine.

 

Any help on this problem?

 

 

Jerry Foote

ScopeCraft, Inc.

4175 E. Red Cliffs Dr.

Kanab, UT 84741

435-899-1255

jfo...@scopecraft.com

 

 



Re: [PHP] Installation of php-5.2.8-win32-installer.msi

2009-01-27 Thread Chris

Jerry Foote wrote:
Tried to install PHP using this installer and about 2/3 of the way 
through the installation I get an error message:


 

 

I am trying to install the IIS ISAPI module and MySQL to the hard drive 
under c:\Program Files\PHP on an XP Professional SP2 machine.


The mailing list doesn't accept attachments so you'll have to write out 
the error by hand.


--
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] Programming general question

2009-01-27 Thread Paul M Foster
On Tue, Jan 27, 2009 at 05:18:35PM -0600, Terion Miller wrote:

 I googled this and didn't find an answer 
 my question is how do you know when to use an object or array
 
 would an object just be 1 instance, and array is several things together ( I
 know infantile coder language I use..but I'm a baby still in this)
 
 Can someone explain objects and arrays in plain speak for me?

An array is like in math, except that an array in PHP stores anything
you like. It's just a bunch of them together.

An object can also store a bunch of different things, but it also has
methods, which are really just functions. An array won't actually *do*
anything; you have to do things *to* it. An object can actually do stuff
at your direction. Like:

$kitchen-make_coffee('cream', 'sugar');

The object here is $kitchen, and you've told it to use its make_coffee()
method, which does something or another. You can also make those
methods private so that code outside the object can't see them.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Installation of php-5.2.8-win32-installer.msi

2009-01-27 Thread Chris
Always cc the mailing list so others can offer suggestions/advice and so 
it will also show up in the archives later on.


Jerry Foote wrote:

The error message is:

 

There is a problem with this Windows Installer package. A script 
required for this install to complete could not be run. Contact your 
support personnel or package vendor.


Anything in the windows event log?

If not I'd probably ask either on the windows mailing list or the 
install list. You can sign up for either/or here:


http://www.php.net/mailing-lists.php

--
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] Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread revDAVE
Thanks so much for everyone's help!

I fooled with this and it was cool...

In the mysql client, do a SHOW CREATE TABLE tableName\G

And ultimately got it working with:


-

The MySQL syntax to alter a column is:

ALTER TABLE `table` MODIFY `column` BIGINT NOT NULL;

[ http://dev.mysql.com/doc/refman/5.1/en/alter-table.html ]

The sql statement

SHOW COLUMNSFROM `table`;

[ http://dev.mysql.com/doc/refman/5.1/en/show-columns.html ]

Thanks again


--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Installation of php-5.2.8-win32-installer.msi

2009-01-27 Thread Ashley Sheridan
On Wed, 2009-01-28 at 12:52 +1100, Chris wrote:
 Jerry Foote wrote:
  Tried to install PHP using this installer and about 2/3 of the way 
  through the installation I get an error message:
  
   
  
   
  
  I am trying to install the IIS ISAPI module and MySQL to the hard drive 
  under c:\Program Files\PHP on an XP Professional SP2 machine.
 
 The mailing list doesn't accept attachments so you'll have to write out 
 the error by hand.
 
 -- 
 Postgresql  php tutorials
 http://www.designmagick.com/
 
 
Or link to an online image of the error.


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php