[PHP] Re: Stupid question

2013-02-27 Thread Jim Giner

On 2/26/2013 4:27 PM, Curtis Maurand wrote:

I have the following:

$dsn = mysqli://$username:$password@$hostname2/$database;
$options = array(
 'debug' = 3,
 'result_buffering' = false,
   );
   $dbh = MDB2::factory($dsn, $options);
 if (PEAR::isError($mdb2))
 {
 die($mdb2-getMessage());
 }




function tallyCart($_u_id,$dbh){
while($row = $result-fetchrow(MDB2_FETCHMODE_ASSOC)) {
 $_showCheckOut=1;
 $_pdetail=new ProductDetail($row{'product_ID'},
$row{'product_Quantity'}, $_u_id);
  $_getSubTotal += $_pdetail-_subTotal;
  $_counter++;
 }
}

I'm getting:  Call to undefined method MDB2_Error::fetchrow()

anyone have any ideas?  Can I not pass a database handle to a function?

Thanks,
Curtis



This may be that stupid answer, but I see what appears to be two problems.

1 - $result is not declared globally in your function header, so hence 
it's undefined, hence all of its methods are.


2 - you have a couple indices wrapped in curly braces, not parens.  Is 
that some new kind of syntax I'm not aware of?



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



Re: [PHP] Re: Stupid question

2013-02-27 Thread Serge Fonville
Perhaps he could share all relevant code, since at this time we are mostly
guessing.
Declaration/assignment of a lot of variables isn't included in the snippets.

HTH

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table


2013/2/27 Jim Giner jim.gi...@albanyhandball.com

 On 2/26/2013 4:27 PM, Curtis Maurand wrote:

 I have the following:

 $dsn = mysqli://$username:$password@**$hostname2/$database;
 $options = array(
  'debug' = 3,
  'result_buffering' = false,
);
$dbh = MDB2::factory($dsn, $options);
  if (PEAR::isError($mdb2))
  {
  die($mdb2-getMessage());
  }




 function tallyCart($_u_id,$dbh){
 while($row = $result-fetchrow(MDB2_**FETCHMODE_ASSOC)) {
  $_showCheckOut=1;
  $_pdetail=new ProductDetail($row{'product_**ID'},
 $row{'product_Quantity'}, $_u_id);
   $_getSubTotal += $_pdetail-_subTotal;
   $_counter++;
  }
 }

 I'm getting:  Call to undefined method MDB2_Error::fetchrow()

 anyone have any ideas?  Can I not pass a database handle to a function?

 Thanks,
 Curtis


 This may be that stupid answer, but I see what appears to be two problems.

 1 - $result is not declared globally in your function header, so hence
 it's undefined, hence all of its methods are.

 2 - you have a couple indices wrapped in curly braces, not parens.  Is
 that some new kind of syntax I'm not aware of?



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




RE: [PHP] Re: Stupid question

2013-02-27 Thread Ford, Mike
 -Original Message-
 From: Jim Giner [mailto:jim.gi...@albanyhandball.com]
 Sent: 27 February 2013 12:28
 
 
 2 - you have a couple indices wrapped in curly braces, not parens.
 Is
 that some new kind of syntax I'm not aware of?

No, that's some old kind of syntax you have no reason to be aware of :).

Curly braces as an alternative to square brackets have been deprecated for,
oooh, probably several years now...!


Cheers!

Mike

-- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Portland PD507, City Campus, Leeds Metropolitan University,
Portland Way, LEEDS,  LS1 3HE,  United Kingdom 
E: m.f...@leedsmet.ac.uk T: +44 113 812 4730




To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



[PHP] A stupid question about classes

2010-05-01 Thread Andre Polykanine
Hello everyone,
Just a basic question.
I have my class starting like this:

Class OireMail {
// these are required
public $smtp_server=;
public $domain=;
public $from=;
public $login=;
public $pass=;

And then go the function themselves.
I was told that it's better to put the initial variables in the
__construct() function. What are the advantages of doing that and if I
need to do it, how would I call the class from another file then?
Thanks!

-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



Re: [PHP] A stupid question about classes

2010-05-01 Thread Nilesh Govindarajan

On 05/01/2010 10:23 PM, Andre Polykanine wrote:

Hello everyone,
Just a basic question.
I have my class starting like this:

Class OireMail {
// these are required
public $smtp_server=;
public $domain=;
public $from=;
public $login=;
public $pass=;

And then go the function themselves.
I was told that it's better to put the initial variables in the
__construct() function. What are the advantages of doing that and if I
need to do it, how would I call the class from another file then?
Thanks!



The advantages of initializing the variables in __construct() is that 
whenever an object of the class is created, the variables have the 
values you expect.


If you don't put them in __construct(), you will have to create another 
method which will have to be called after you have created the object 
using the new operator.


Ultimately its the same thing, __construct() is called automatically, 
only that's the difference.


--
Nilesh Govindarajan
Site  Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

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



Re[2]: [PHP] A stupid question about classes

2010-05-01 Thread Andre Polykanine
Hello Nilesh,

So could you illustrate a bit the __construct() function, please?
Should I pass those variables as parameters of that function? And what
if I need to change their values?)
Thanks!
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Nilesh Govindarajan li...@itech7.com
To: php-general@lists.php.net php-general@lists.php.net
Date: Saturday, May 1, 2010, 8:16:37 PM
Subject: [PHP] A stupid question about classes

On 05/01/2010 10:23 PM, Andre Polykanine wrote:
 Hello everyone,
 Just a basic question.
 I have my class starting like this:

 Class OireMail {
 // these are required
 public $smtp_server=;
 public $domain=;
 public $from=;
 public $login=;
 public $pass=;

 And then go the function themselves.
 I was told that it's better to put the initial variables in the
 __construct() function. What are the advantages of doing that and if I
 need to do it, how would I call the class from another file then?
 Thanks!


The advantages of initializing the variables in __construct() is that 
whenever an object of the class is created, the variables have the 
values you expect.

If you don't put them in __construct(), you will have to create another 
method which will have to be called after you have created the object 
using the new operator.

Ultimately its the same thing, __construct() is called automatically, 
only that's the difference.

-- 
Nilesh Govindarajan
Site  Server Administrator
www.itech7.com
   !
?? : ??  !

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



Re: Re[2]: [PHP] A stupid question about classes

2010-05-01 Thread Richard Quadling
On 1 May 2010 20:38, Andre Polykanine an...@oire.org wrote:
 Hello Nilesh,

 So could you illustrate a bit the __construct() function, please?
 Should I pass those variables as parameters of that function? And what
 if I need to change their values?)
 Thanks!

?php
// The generic class which can act standalone.
Class OireMail {
// these are required
public $smtp_server=;
public $domain=;
public $from=;
public $login=;
public $pass=;

public function __construct($smtp_server = '', $domain = '', $from =
'', $login = '', $pass = '') {
$this-stmp_server = $smtp_server;
$this-domain = $domain;
$this-from = $from;
$this-login = $login;
$this-pass = $pass;
}
}

// Let's create a generic email class and supply all the params.
$Mail = new OireMail('Server', 'Domain', 'f...@domain.com', 'login',
'Passw0rd');


// A more specialised version of the class with all the required params pre set.
Class SpecialisedOireMail extends OireMail {
public function __construct() {
parent::__construct('SpecServer', 'SpecDomain',
's...@specdomain.com', 'SpecLogin', 'SpecPassw0rd');
}
}

// Let's create a specialised version. Note - no need to supply params
as the sub-class deals with that.
$SpecMail = new SpecialisedOireMail();

var_dump($Mail, $SpecMail);
?

outputs ...

object(OireMail)#1 (6) {
  [smtp_server]=
  string(0) 
  [domain]=
  string(6) Domain
  [from]=
  string(15) f...@domain.com
  [login]=
  string(5) login
  [pass]=
  string(8) Passw0rd
  [stmp_server]=
  string(6) Server
}
object(SpecialisedOireMail)#2 (6) {
  [smtp_server]=
  string(0) 
  [domain]=
  string(10) SpecDomain
  [from]=
  string(19) s...@specdomain.com
  [login]=
  string(9) SpecLogin
  [pass]=
  string(12) SpecPassw0rd
  [stmp_server]=
  string(10) SpecServer
}


Hope that helps.

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re[4]: [PHP] A stupid question about classes

2010-05-01 Thread Andre Polykanine
Hello Richard,

thanks a lot!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Richard Quadling rquadl...@googlemail.com
To: Andre Polykanine an...@oire.org
Date: Saturday, May 1, 2010, 10:49:49 PM
Subject: [PHP] A stupid question about classes

On 1 May 2010 20:38, Andre Polykanine an...@oire.org wrote:
 Hello Nilesh,

 So could you illustrate a bit the __construct() function, please?
 Should I pass those variables as parameters of that function? And what
 if I need to change their values?)
 Thanks!

?php
// The generic class which can act standalone.
Class OireMail {
// these are required
public $smtp_server=;
public $domain=;
public $from=;
public $login=;
public $pass=;

public function __construct($smtp_server = '', $domain = '', $from =
'', $login = '', $pass = '') {
$this-stmp_server = $smtp_server;
$this-domain = $domain;
$this-from = $from;
$this-login = $login;
$this-pass = $pass;
}
}

// Let's create a generic email class and supply all the params.
$Mail = new OireMail('Server', 'Domain', 'f...@domain.com', 'login',
'Passw0rd');


// A more specialised version of the class with all the required params pre set.
Class SpecialisedOireMail extends OireMail {
public function __construct() {
parent::__construct('SpecServer', 'SpecDomain',
's...@specdomain.com', 'SpecLogin', 'SpecPassw0rd');
}
}

// Let's create a specialised version. Note - no need to supply params
as the sub-class deals with that.
$SpecMail = new SpecialisedOireMail();

var_dump($Mail, $SpecMail);
?

outputs ...

object(OireMail)#1 (6) {
  [smtp_server]=
  string(0) 
  [domain]=
  string(6) Domain
  [from]=
  string(15) f...@domain.com
  [login]=
  string(5) login
  [pass]=
  string(8) Passw0rd
  [stmp_server]=
  string(6) Server
}
object(SpecialisedOireMail)#2 (6) {
  [smtp_server]=
  string(0) 
  [domain]=
  string(10) SpecDomain
  [from]=
  string(19) s...@specdomain.com
  [login]=
  string(9) SpecLogin
  [pass]=
  string(12) SpecPassw0rd
  [stmp_server]=
  string(10) SpecServer
}


Hope that helps.

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling


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



RE: [PHP] A stupid question?

2008-01-20 Thread Shelley Shyan



Regards,
Shelley

-Original Message-
From: Eric Butera [mailto:[EMAIL PROTECTED]
Sent: Saturday, January 19, 2008 12:03 AM
To: Jochem Maas
Cc: php-general@lists.php.net
Subject: Re: [PHP] A stupid question?

On Jan 18, 2008 10:49 AM, Jochem Maas [EMAIL PROTECTED] wrote:

 Eric Butera schreef:
  On Jan 18, 2008 9:31 AM, Jochem Maas [EMAIL PROTECTED] wrote:
  Eric Butera schreef:
  On Jan 17, 2008 9:54 PM, Shelley Shyan [EMAIL PROTECTED] wrote:
  Hi all,
 
  Maybe this is a somehow stupid question.
 
  I want to know how php could know whether session_start() has been 
  called, that is, whether session has been started.
 
  I Googled, but got little help.
 
  Thank you for help!
  Any tip is greatly appreciated.
 
  Regards,
  Shelley
 
 
 
  One other thing is you won't be able to start a session if headers
  have been sent.  It is a good idea to use output buffering to help
  aid with this.
  no it's not a good idea to use output bufferin to 'help aid' this.
  instead write code that is logically structured so that the
  initialization of your pages/app/scripts occurs BEFORE any output is 
  generated.
 
  to avoid spurious output of whitespace avoid including the trailing
  '?' is included php[-only] files. (and ignore whatever Tedd says
  on the subject ;-)
 
  If headers have been sent you'll get a nasty warning.
  if (headers_sent()) {
  echo oops!;
  }
 
  use code to avoid warnings.
 
 
  It can be a php.ini setting or you can simply call ob_start() on
  the first line of your script.
 
 
 
  I agree with you that it is ideal to do what you're saying but it
  isn't always 100% practical.  Sometimes the stuff we work on is
  handed down and in our purist world we'd like to change it, but
  can't.  So I think that you should recommend best practices for
  future creations, but blindly shooting down all alternatives isn't
  right.  My solution would get the job done rather than the OP
  refactoring the pages and not getting paid for it.  It would work
  and over time things could be tidied up on future revisions over time.

 still, it's not a good idea because that implies a concept that you
 are wanting to apply. you don't want to use output buffering if you can help 
 it.

 output buffering to overcome output being created before headers are
 [conditionally] sent in badly written code is a viable hack given
 certain budgetary and/or time constraints.

 what I'm saying is it's a viable solution to a immediate problem for
 which you don't have the time/money to fix properly - it's more than
 fine to enlighted the OP as such, I just don't think calling it a good
 idea is the right thing to do - it gives the impression that your
 giving it the seal-of-good-coding-practice-approval, and the OP might
 just take your word for it.

  Also, if you do what you've said and created your logic 100%
  perfectly, there should never be any use for headers_sent(), right?
  Headers shouldn't have been sent until you've specifically sent them.

 true, and they are not - but if you want to be sure to avoid cruft in
 the output and/or shit in the logs you program defensively for those
 occasions where somebody [else?] makes a mistake of some kind.


Fair enough, you win!  :)

Thank you all. Thank you very much. :-)

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



Re: [PHP] A stupid question?

2008-01-18 Thread Jochem Maas

Shelley Shyan schreef:

Hi all,

Maybe this is a somehow stupid question.

I want to know how php could know whether session_start() has been called, that 
is, whether session has been started.


you can do it by checking the return value of session_id() if it's empty you 
can be pretty
sure session_start() was not called. having said that I think your better off
writing code that can assume the session was started (e.g. by including a
file that init's the session [and whatever else is relevant) ... but that may
not be doable.

see here: http://php.net/session_id

I don't recommend the auto_session_start ini setting because there are probably
times when you explicitly don't need/want the session started.



I Googled, but got little help.

Thank you for help!
Any tip is greatly appreciated.

Regards,
Shelley



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



Re: [PHP] A stupid question?

2008-01-18 Thread Eric Butera
On Jan 18, 2008 9:31 AM, Jochem Maas [EMAIL PROTECTED] wrote:
 Eric Butera schreef:
  On Jan 17, 2008 9:54 PM, Shelley Shyan [EMAIL PROTECTED] wrote:
  Hi all,
 
  Maybe this is a somehow stupid question.
 
  I want to know how php could know whether session_start() has been called, 
  that is, whether session has been started.
 
  I Googled, but got little help.
 
  Thank you for help!
  Any tip is greatly appreciated.
 
  Regards,
  Shelley
 
 
 
 
  One other thing is you won't be able to start a session if headers
  have been sent.  It is a good idea to use output buffering to help aid
  with this.

 no it's not a good idea to use output bufferin to 'help aid' this. instead
 write code that is logically structured so that the initialization of your 
 pages/app/scripts
 occurs BEFORE any output is generated.

 to avoid spurious output of whitespace avoid including the trailing '?' is
 included php[-only] files. (and ignore whatever Tedd says on the subject ;-)

  If headers have been sent you'll get a nasty warning.

 if (headers_sent()) {
 echo oops!;
 }

 use code to avoid warnings.


 
  It can be a php.ini setting or you can simply call ob_start() on the
  first line of your script.
 



I agree with you that it is ideal to do what you're saying but it
isn't always 100% practical.  Sometimes the stuff we work on is handed
down and in our purist world we'd like to change it, but can't.  So I
think that you should recommend best practices for future creations,
but blindly shooting down all alternatives isn't right.  My solution
would get the job done rather than the OP refactoring the pages and
not getting paid for it.  It would work and over time things could be
tidied up on future revisions over time.

Also, if you do what you've said and created your logic 100%
perfectly, there should never be any use for headers_sent(), right?
Headers shouldn't have been sent until you've specifically sent them.
Just a friendly jab! :D

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



Re: [PHP] A stupid question?

2008-01-18 Thread Jochem Maas

Eric Butera schreef:

On Jan 18, 2008 9:31 AM, Jochem Maas [EMAIL PROTECTED] wrote:

Eric Butera schreef:

On Jan 17, 2008 9:54 PM, Shelley Shyan [EMAIL PROTECTED] wrote:

Hi all,

Maybe this is a somehow stupid question.

I want to know how php could know whether session_start() has been called, that 
is, whether session has been started.

I Googled, but got little help.

Thank you for help!
Any tip is greatly appreciated.

Regards,
Shelley




One other thing is you won't be able to start a session if headers
have been sent.  It is a good idea to use output buffering to help aid
with this.

no it's not a good idea to use output bufferin to 'help aid' this. instead
write code that is logically structured so that the initialization of your 
pages/app/scripts
occurs BEFORE any output is generated.

to avoid spurious output of whitespace avoid including the trailing '?' is
included php[-only] files. (and ignore whatever Tedd says on the subject ;-)


If headers have been sent you'll get a nasty warning.

if (headers_sent()) {
echo oops!;
}

use code to avoid warnings.



It can be a php.ini setting or you can simply call ob_start() on the
first line of your script.





I agree with you that it is ideal to do what you're saying but it
isn't always 100% practical.  Sometimes the stuff we work on is handed
down and in our purist world we'd like to change it, but can't.  So I
think that you should recommend best practices for future creations,
but blindly shooting down all alternatives isn't right.  My solution
would get the job done rather than the OP refactoring the pages and
not getting paid for it.  It would work and over time things could be
tidied up on future revisions over time.


still, it's not a good idea because that implies a concept that you are
wanting to apply. you don't want to use output buffering if you can help it.

output buffering to overcome output being created before headers are 
[conditionally]
sent in badly written code is a viable hack given certain budgetary and/or time
constraints.

what I'm saying is it's a viable solution to a immediate problem for
which you don't have the time/money to fix properly - it's more than fine
to enlighted the OP as such, I just don't think calling it a good idea
is the right thing to do - it gives the impression that your giving
it the seal-of-good-coding-practice-approval, and the OP might just take
your word for it.


Also, if you do what you've said and created your logic 100%
perfectly, there should never be any use for headers_sent(), right?
Headers shouldn't have been sent until you've specifically sent them.


true, and they are not - but if you want to be sure to avoid cruft in the
output and/or shit in the logs you program defensively for those occasions
where somebody [else?] makes a mistake of some kind.

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



Re: [PHP] A stupid question?

2008-01-18 Thread Eric Butera
On Jan 18, 2008 10:49 AM, Jochem Maas [EMAIL PROTECTED] wrote:

 Eric Butera schreef:
  On Jan 18, 2008 9:31 AM, Jochem Maas [EMAIL PROTECTED] wrote:
  Eric Butera schreef:
  On Jan 17, 2008 9:54 PM, Shelley Shyan [EMAIL PROTECTED] wrote:
  Hi all,
 
  Maybe this is a somehow stupid question.
 
  I want to know how php could know whether session_start() has been 
  called, that is, whether session has been started.
 
  I Googled, but got little help.
 
  Thank you for help!
  Any tip is greatly appreciated.
 
  Regards,
  Shelley
 
 
 
  One other thing is you won't be able to start a session if headers
  have been sent.  It is a good idea to use output buffering to help aid
  with this.
  no it's not a good idea to use output bufferin to 'help aid' this. instead
  write code that is logically structured so that the initialization of your 
  pages/app/scripts
  occurs BEFORE any output is generated.
 
  to avoid spurious output of whitespace avoid including the trailing '?' is
  included php[-only] files. (and ignore whatever Tedd says on the subject 
  ;-)
 
  If headers have been sent you'll get a nasty warning.
  if (headers_sent()) {
  echo oops!;
  }
 
  use code to avoid warnings.
 
 
  It can be a php.ini setting or you can simply call ob_start() on the
  first line of your script.
 
 
 
  I agree with you that it is ideal to do what you're saying but it
  isn't always 100% practical.  Sometimes the stuff we work on is handed
  down and in our purist world we'd like to change it, but can't.  So I
  think that you should recommend best practices for future creations,
  but blindly shooting down all alternatives isn't right.  My solution
  would get the job done rather than the OP refactoring the pages and
  not getting paid for it.  It would work and over time things could be
  tidied up on future revisions over time.

 still, it's not a good idea because that implies a concept that you are
 wanting to apply. you don't want to use output buffering if you can help it.

 output buffering to overcome output being created before headers are 
 [conditionally]
 sent in badly written code is a viable hack given certain budgetary and/or 
 time
 constraints.

 what I'm saying is it's a viable solution to a immediate problem for
 which you don't have the time/money to fix properly - it's more than fine
 to enlighted the OP as such, I just don't think calling it a good idea
 is the right thing to do - it gives the impression that your giving
 it the seal-of-good-coding-practice-approval, and the OP might just take
 your word for it.

  Also, if you do what you've said and created your logic 100%
  perfectly, there should never be any use for headers_sent(), right?
  Headers shouldn't have been sent until you've specifically sent them.

 true, and they are not - but if you want to be sure to avoid cruft in the
 output and/or shit in the logs you program defensively for those occasions
 where somebody [else?] makes a mistake of some kind.


Fair enough, you win!  :)

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



Re: [PHP] A stupid question?

2008-01-18 Thread Jochem Maas

Eric Butera schreef:

On Jan 17, 2008 9:54 PM, Shelley Shyan [EMAIL PROTECTED] wrote:

Hi all,

Maybe this is a somehow stupid question.

I want to know how php could know whether session_start() has been called, that 
is, whether session has been started.

I Googled, but got little help.

Thank you for help!
Any tip is greatly appreciated.

Regards,
Shelley





One other thing is you won't be able to start a session if headers
have been sent.  It is a good idea to use output buffering to help aid
with this. 


no it's not a good idea to use output bufferin to 'help aid' this. instead
write code that is logically structured so that the initialization of your 
pages/app/scripts
occurs BEFORE any output is generated.

to avoid spurious output of whitespace avoid including the trailing '?' is
included php[-only] files. (and ignore whatever Tedd says on the subject ;-)


If headers have been sent you'll get a nasty warning.


if (headers_sent()) {
echo oops!;
}

use code to avoid warnings.



It can be a php.ini setting or you can simply call ob_start() on the
first line of your script.



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



Re: [PHP] A stupid question?

2008-01-18 Thread Richard Lynch
if (session_id()){
  //no session yet
}
else{
  //we have lift-off!
}

On Thu, January 17, 2008 8:54 pm, Shelley Shyan wrote:
 Hi all,

 Maybe this is a somehow stupid question.

 I want to know how php could know whether session_start() has been
 called, that is, whether session has been started.

 I Googled, but got little help.

 Thank you for help!
 Any tip is greatly appreciated.

 Regards,
 Shelley




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] A stupid question?

2008-01-18 Thread Eric Butera
On Jan 17, 2008 9:54 PM, Shelley Shyan [EMAIL PROTECTED] wrote:
 Hi all,

 Maybe this is a somehow stupid question.

 I want to know how php could know whether session_start() has been called, 
 that is, whether session has been started.

 I Googled, but got little help.

 Thank you for help!
 Any tip is greatly appreciated.

 Regards,
 Shelley




One other thing is you won't be able to start a session if headers
have been sent.  It is a good idea to use output buffering to help aid
with this.  If headers have been sent you'll get a nasty warning.

It can be a php.ini setting or you can simply call ob_start() on the
first line of your script.

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



[PHP] A stupid question?

2008-01-17 Thread Shelley Shyan
Hi all,

Maybe this is a somehow stupid question.

I want to know how php could know whether session_start() has been called, that 
is, whether session has been started.

I Googled, but got little help.

Thank you for help!
Any tip is greatly appreciated.

Regards,
Shelley



Re: [PHP] A stupid question?

2008-01-17 Thread Jim Lucas

Shelley Shyan wrote:

Hi all,

Maybe this is a somehow stupid question.

I want to know how php could know whether session_start() has been called, that 
is, whether session has been started.

I Googled, but got little help.

Thank you for help!
Any tip is greatly appreciated.

Regards,
Shelley



http://us3.php.net/session_id

is what you are looking for.

Look at the notes for the Return Values section

session_id() returns the session id for the current session or the 
empty string () if there is no current session (no current session id 
exists).


So, something like this will do.

?php

$sid = session_id();
if ( $sid == '' ) {
// No session started yet.
} else {
// Session has been started.
}
?

Jim

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



Re: [PHP] A stupid question?

2008-01-17 Thread David Wonderly

On Fri, 2008-01-18 at 10:54 +0800, Shelley Shyan wrote:
 Hi all,
 
 Maybe this is a somehow stupid question.
 
 I want to know how php could know whether session_start() has been called, 
 that is, whether session has been started.
 
 I Googled, but got little help.
 
 Thank you for help!
 Any tip is greatly appreciated.
 
 Regards,
 Shelley
 

Hey Shelley, maybe I can help you understand Sessions. When you start a
Sessions PHP creates a Session ID. This is then used to create/Store
information in a file or in a database. The configuration of this is in
your php.ini file. If this file you can change where the session is
saved as well as other options. A simple way to use Sessions is with
cookies with the session.use_cookie = 1 in the php.ini file. However, if
the client doesn't allow cookies there is a second way;
session.use_trans_sid = 0 there are a few problems however, it creates a
security risk.

Anyway, I hope this opens a little on how sessions works. If you wish to
learn more about sessions go to http://us2.php.net/session or
http://w3schools.com/php/php_sessions.asp

David Wonderly
WebGenero

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



[PHP] Re: Stupid question

2004-12-04 Thread Peter Lauri
Do phpinfo() for that, you will find that information there.

/Peter


Phpu [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
Hi,

If i have a php and mysql website...how many connections support mysql at
one time ?

Thanks

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



[PHP] Re: Stupid question

2004-12-04 Thread Matthew Weier O'Phinney
* Phpu [EMAIL PROTECTED]:
 If i have a php and mysql website...how many connections support mysql =
 at one time ?

Depends on your mysql setup; you'll have to look at the mysql
configuration file (/etc/my.cnf on most *nices).

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



RE: [PHP] a stupid question

2004-06-25 Thread Alicia Riggs
Your problem is the paren's

echo 'some text' $aFunction 'some more text';


You need double quotes for the entire string, but single quotes around
the text so it knows it is text.  


Alicia Riggs
Professional Services Group
Senior Web Development Engineer
214-550-7452


-Original Message-
From: Blake Schroeder [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 4:45 PM
To: PHP List
Subject: [PHP] a stupid question


Hey

I cant figureout the syntax please help

echo Some text.aFunction().some more text;

The function is not working.

Thanks

-B

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



Re: [PHP] a stupid question

2004-06-25 Thread Randy C Boland
That would work if aFunction was a variable - more less.  It would
display the inner single quotes, so you'd really want:
echo some text $aFunction some more text;

However, aFunction is, ironically, a function, so it needs to be a
function call.
echo some text . aFunction() . some more text;

On Fri, 25 Jun 2004 10:09:42 -0500, Alicia Riggs
[EMAIL PROTECTED] wrote:
 
 Your problem is the paren's
 
 echo 'some text' $aFunction 'some more text';
 
 You need double quotes for the entire string, but single quotes around
 the text so it knows it is text.

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



RE: [PHP] a stupid question

2004-06-25 Thread Philip Olson

 I cant figureout the syntax please help
 
 echo Some text.aFunction().some more text;
 
 The function is not working.

 Your problem is the paren's
 
 echo 'some text' $aFunction 'some more text';
 
 You need double quotes for the entire string, but single 
 quotes around the text so it knows it is text.  

This is very much incorrect, not sure where to begin
but please ignore this advice.  A string is a string
is a string is a string:

  http://www.php.net/types.string

I'm 99% sure the problem is aFunction() is echoing
a value as opposed to returning one, this is a
common question answered here:

  http://www.php.net/manual/en/faq.using.php#faq.using.wrong-order

If that doesn't answer your question then please
post the code.

Regarding the subject of this thread you should consider
asking smart questions by reading the following in its
entirety:

  http://www.catb.org/~esr/faqs/smart-questions.html

Very useful for all parties involved! :)

Regards,
Philip

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



Re: [PHP] a stupid question

2004-06-25 Thread Blake Schroeder
Everyone
Thank you for all the great feedback. Since my function doesnt return 
data it just echos it to the browser.

When I use this format it does not display correctly
echo some text . aFunction() . some more text;
If I use the orginal code it displays fine.
echo  Some text;
aFunction();
echo More text;
Thanks for all the help.
-B
Philip Olson wrote:
I cant figureout the syntax please help
echo Some text.aFunction().some more text;
The function is not working.
 

Your problem is the paren's
echo 'some text' $aFunction 'some more text';
You need double quotes for the entire string, but single 
quotes around the text so it knows it is text.  
   

This is very much incorrect, not sure where to begin
but please ignore this advice.  A string is a string
is a string is a string:
 http://www.php.net/types.string
I'm 99% sure the problem is aFunction() is echoing
a value as opposed to returning one, this is a
common question answered here:
 http://www.php.net/manual/en/faq.using.php#faq.using.wrong-order
If that doesn't answer your question then please
post the code.
Regarding the subject of this thread you should consider
asking smart questions by reading the following in its
entirety:
 http://www.catb.org/~esr/faqs/smart-questions.html
Very useful for all parties involved! :)
Regards,
Philip
 

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


[PHP] a stupid question

2004-06-24 Thread Blake Schroeder
Hey
I cant figureout the syntax please help
echo Some text.aFunction().some more text;
The function is not working.
Thanks
-B
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] a stupid question

2004-06-24 Thread Ashwin Purohit
Maybe it has to be Some text.aFunction();.sometext; with the
semicolon after the function.
I don't really know, just guessing.

On Thu, 24 Jun 2004 16:44:53 -0500, Blake Schroeder [EMAIL PROTECTED] wrote:
 
 Hey
 
 I cant figureout the syntax please help
 
 echo Some text.aFunction().some more text;
 
 The function is not working.
 
 Thanks
 
 -B
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Ashwin Purohit

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



Re: [PHP] a stupid question

2004-06-24 Thread Matt Matijevich
[snip]
echo Some text.aFunction().some more text;
[/snip]

Have you checked to see if aFunction() is returning anything?

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



Re: [PHP] a stupid question

2004-06-24 Thread Blake Schroeder
The following code works:
echo Some text;
aFunction();
echo Some more text;
-B
Matt Matijevich wrote:
[snip]
echo Some text.aFunction().some more text;
[/snip]
Have you checked to see if aFunction() is returning anything?

.
 

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


Re: [PHP] a stupid question

2004-06-24 Thread David Goodlad
Perhaps using:

$ret = aFunction();
var_dump($ret);

Then you'll see if aFunction() is returning anything.

Dave

On Thu, 24 Jun 2004 16:48:18 -0500, Matt Matijevich
[EMAIL PROTECTED] wrote:
 
 [snip]
 echo Some text.aFunction().some more text;
 [/snip]
 
 Have you checked to see if aFunction() is returning anything?
 
 
 
 --
 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



Re: [PHP] a stupid question

2004-06-24 Thread Matt Matijevich
[snip]
echo Some text;
aFunction();
echo Some more text;
[/snip]

What is printed out?

if aFunction() is returning the string test then this code: echo
Some text.aFunction().some more text; should print out:

Some texttestsome more text

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



RE: [PHP] a stupid question

2004-06-24 Thread Vail, Warren
Your test that works suggests that the function is echoing its results,
and not actually returning its results.  To return its results the function
needs to end with

Function aFunction() {
  do something;
Return $resultstring;  // very last statement executed in function. 
}

This should allow

Echo some string value.aFunction().another string value;

To work,

Good luck,

Warren Vail
 


-Original Message-
From: Matt Matijevich [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 3:00 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] a stupid question


[snip]
echo Some text;
aFunction();
echo Some more text;
[/snip]

What is printed out?

if aFunction() is returning the string test then this code: echo Some
text.aFunction().some more text; should print out:

Some texttestsome more text

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



Re: [PHP] a stupid question

2004-06-24 Thread Michal Migurski
 Maybe it has to be Some text.aFunction();.sometext; with the
 semicolon after the function.
 I don't really know, just guessing.

Yeesh, that's not even remotely valid PHP. Why would that have been posted
as advice?

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] a stupid question

2004-06-24 Thread Curt Zirzow
* Thus wrote Blake Schroeder:
 Hey
 
 I cant figureout the syntax please help
 
 echo Some text.aFunction().some more text;
 
 The function is not working.

For future reference, to make you're post not a stupid question it
would look more like:

snip
Subject: Calling a function between strings

I have some code that looks like this:
  echo Some Text.aFunction().some more text;

I keep getting the output like this:
  Text From function Some Textsomemore text
 

And I can't figure out why it keeps doing that.

/snip

That will:
  1. let people know what the topic is before reading the mail.
  2. Prevent everyone darkstabbing/dark at what is wrong.


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



[PHP] Re: Stupid question

2004-03-17 Thread Luis Mirabal
when you are working with classes and objects in php, and you are coding
inside a class, you must use the $this variable to access the members of the
class, for example:

class test {

//Class vars (something like properties)
var $a;
var $b;
var $c;
var $sum;

//Class function (Constructor)
function test() {
$this-a = 'value for a';
$this-b = 'value for b';
$this-c = 'value for c';
$this-set();
}

//Class function
function set() {
$sum = $this-a . $this-b . $this-c;
}

} //end class

luis.

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



[PHP] Re: Stupid question

2004-03-17 Thread Luis Mirabal
as Chris W. Parker noticed, there is a little mistake in the example above
posted by me, it says:

//Class function
function set() {
$sum = $this-a . $this-b . $this-c;
}

and it should say:

//Class function
function set() {
$this-sum = $this-a . $this-b . $this-c;
}

sorry :P
luis.

Luis Mirabal [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 when you are working with classes and objects in php, and you are coding
 inside a class, you must use the $this variable to access the members of
the
 class, for example:

 class test {

 //Class vars (something like properties)
 var $a;
 var $b;
 var $c;
 var $sum;

 //Class function (Constructor)
 function test() {
 $this-a = 'value for a';
 $this-b = 'value for b';
 $this-c = 'value for c';
 $this-set();
 }

 //Class function
 function set() {
 $sum = $this-a . $this-b . $this-c;
 }

 } //end class

 luis.

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



RE: [PHP] Re: Stupid question

2004-03-17 Thread Chris W. Parker
Luis Mirabal mailto:[EMAIL PROTECTED]
on Wednesday, March 17, 2004 3:18 PM said:

 as Chris W. Parker noticed, there is a little mistake in the example
 above posted by me, it says:

i'd like to thank the academy, my parents, God, my cat, and all of those
that voted for me!

thank you!

kisses


:)

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



[PHP] a stupid question

2003-07-24 Thread Joe
how to check the filetype of remote file
because is_dir(), is_file() can't work on remote file
thx a lot



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



Re: [PHP] a stupid question

2003-07-24 Thread Jacob Vennervald Madsen
Download it and then check it. But if you need to check a lot of files
that's probably to slow.

Jacob Vennervald

On Thu, 2003-07-24 at 06:03, Joe wrote:
 how to check the filetype of remote file
 because is_dir(), is_file() can't work on remote file
 thx a lot
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
-- 
Venlig hilsen / Best regards,
Jacob Vennervald
System Developer
Proventum Solutions ApS
Tuborg Boulevard 12
2900 Hellerup
Denmark
Phone:  +45 36 94 41 66
Mobile: +45 61 68 58 51



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



Re: [PHP] a stupid question

2003-07-24 Thread Joe
thx

Jacob Vennervald Madsen [EMAIL PROTECTED] ¼¶¼g©ó¶l¥ó·s»D
:[EMAIL PROTECTED]
 Download it and then check it. But if you need to check a lot of files
 that's probably to slow.

 Jacob Vennervald

 On Thu, 2003-07-24 at 06:03, Joe wrote:
  how to check the filetype of remote file
  because is_dir(), is_file() can't work on remote file
  thx a lot
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 --
 Venlig hilsen / Best regards,
 Jacob Vennervald
 System Developer
 Proventum Solutions ApS
 Tuborg Boulevard 12
 2900 Hellerup
 Denmark
 Phone: +45 36 94 41 66
 Mobile: +45 61 68 58 51





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



[PHP] Re: Stupid question, sorry...

2003-02-06 Thread Mathieu Dumoulin
All single quotes around variables or escape characters are written out man!

it's as simple as that.

example you have a variable named $hey and you want to output $hey, you
can't it's gonna replace the content of that string with the value of $hey.

When you put stuff inside ' ' they are not escaped by the system

Mathiue Dumoulin

Chris Boget [EMAIL PROTECTED] a écrit dans le message de news:
021901c2cdf4$4a806d00$[EMAIL PROTECTED]
 Why is it that \n gets translated to a _new line_ when in
 double quotes whereas it's displayed as the literal when
 in single quotes?  I checked out the docs but couldn't
 come up with a definitive answer.  If someone could point
 me to the right page in the docs that explains this, I'd be
 ever so appreciative!

 thnx,
 Chris




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




[PHP] Re: Stupid question, sorry...

2003-02-06 Thread Goetz Lohmann
Chris Boget schrieb:
 Why is it that \n gets translated to a _new line_ when in
 double quotes whereas it's displayed as the literal when
 in single quotes?  I checked out the docs but couldn't 
 come up with a definitive answer.  If someone could point
 me to the right page in the docs that explains this, I'd be
 ever so appreciative!
 
 thnx,
 Chris
 


all inside of  will be interpreted instead of things
between '' will be as is ... and as \n means New Line
it will do this. If you wish to print out a \n then you
have to write it like \\n.

This is true for all special characters like:
\n   - new line
\r   - carriage return
\t   - tab
\- escape sign for the special characters
\\   - backslash itself


-- 
 @  Goetz Lohmann, Germany   |   Web-Developer  Sys-Admin
\/  --
()  He's the fellow that people wonder what he does and
||  why the company needs him, until he goes on vacation.


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




[PHP] Re: stupid question

2002-09-06 Thread nicos

I never saw that is it really working? it is supposed to be $_GLOBAL['lala']
too.. but..

--

Nicos - CHAILLAN Nicolas
[EMAIL PROTECTED]
www.WorldAKT.com - Hébergement de sites Internet

Alex Shi [EMAIL PROTECTED] a écrit dans le message de news:
[EMAIL PROTECTED]
 I have almost two years of experience in PHP. so don't think qualified for
 being a newbie...However still found something don't know when reading
 other's code :(

 Here is what I want to know: $Global{'hello'}. What this means? Is it a
 Variable-variable?

 Alex

 --
 ---
 TrafficBuilder Network:
 http://www.bestadv.net/index.cfm?ref=7029




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




[PHP] Re: stupid question

2002-09-06 Thread Alex Shi

I checked the code again...it is $Globals{'lala'}...


[EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I never saw that is it really working? it is supposed to be
$_GLOBAL['lala']
 too.. but..

 --

 Nicos - CHAILLAN Nicolas
 [EMAIL PROTECTED]
 www.WorldAKT.com - Hébergement de sites Internet

 Alex Shi [EMAIL PROTECTED] a écrit dans le message de news:
 [EMAIL PROTECTED]
  I have almost two years of experience in PHP. so don't think qualified
for
  being a newbie...However still found something don't know when reading
  other's code :(
 
  Here is what I want to know: $Global{'hello'}. What this means? Is it a
  Variable-variable?
 
  Alex
 
  --
  ---
  TrafficBuilder Network:
  http://www.bestadv.net/index.cfm?ref=7029
 




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




[PHP] Re: stupid question

2002-09-06 Thread nicos

It looks like that some yrs ago, the variable $GLOBALS contains all the
variable of the page so thats like describing the variable of the page.
I'm not sure too, I've never tested/used it.

--

Nicos - CHAILLAN Nicolas
[EMAIL PROTECTED]
www.WorldAKT.com - H¨¦bergement de sites Internet

Alex Shi [EMAIL PROTECTED] a ¨¦crit dans le message de news:
[EMAIL PROTECTED]
 I checked the code again...it is $Globals{'lala'}...


 [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I never saw that is it really working? it is supposed to be
 $_GLOBAL['lala']
  too.. but..
 
  --
 
  Nicos - CHAILLAN Nicolas
  [EMAIL PROTECTED]
  www.WorldAKT.com - Hébergement de sites Internet
 
  Alex Shi [EMAIL PROTECTED] a écrit dans le message de news:
  [EMAIL PROTECTED]
   I have almost two years of experience in PHP. so don't think qualified
 for
   being a newbie...However still found something don't know when reading
   other's code :(
  
   Here is what I want to know: $Global{'hello'}. What this means? Is it
a
   Variable-variable?
  
   Alex
  
   --
   ---
   TrafficBuilder Network:
   http://www.bestadv.net/index.cfm?ref=7029
  
 
 




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




Fw: [PHP] Re: stupid question

2002-09-06 Thread Kevin Stone

Try it on your own..

$ary = array('key' = 'val');
$ary['key']; //prints val
$ary{'key'}; //prints val

Square brackets are more common but both are valid array syntax.  There may
be special cases where curly braces are used in place of square brackets..
this I don't know.

Kevin


- Original Message -
From: Alex Shi [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, September 06, 2002 1:28 PM
Subject: [PHP] Re: stupid question


 I checked the code again...it is $Globals{'lala'}...


 [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I never saw that is it really working? it is supposed to be
 $_GLOBAL['lala']
  too.. but..
 
  --
 
  Nicos - CHAILLAN Nicolas
  [EMAIL PROTECTED]
  www.WorldAKT.com - Hébergement de sites Internet
 
  Alex Shi [EMAIL PROTECTED] a écrit dans le message de news:
  [EMAIL PROTECTED]
   I have almost two years of experience in PHP. so don't think qualified
 for
   being a newbie...However still found something don't know when reading
   other's code :(
  
   Here is what I want to know: $Global{'hello'}. What this means? Is it
a
   Variable-variable?
  
   Alex
  
   --
   ---
   TrafficBuilder Network:
   http://www.bestadv.net/index.cfm?ref=7029
  
 
 


 --
 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: stupid question

2002-09-06 Thread nicos

Correction:

/* Get the first character of a string  */
$str = 'This is a test.';
$first = $str{0};
$first will be 'T'

--

Nicos - CHAILLAN Nicolas
[EMAIL PROTECTED]
www.WorldAKT.com - Hébergement de sites Internet

Alex Shi [EMAIL PROTECTED] a écrit dans le message de news:
[EMAIL PROTECTED]
 I have almost two years of experience in PHP. so don't think qualified for
 being a newbie...However still found something don't know when reading
 other's code :(

 Here is what I want to know: $Global{'hello'}. What this means? Is it a
 Variable-variable?

 Alex

 --
 ---
 TrafficBuilder Network:
 http://www.bestadv.net/index.cfm?ref=7029




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




[PHP] Re: stupid question

2002-08-14 Thread Jean-Christian Imbeault

Liam, when you want to post a new message to the list don't just hit the 
reply button and change the subject. If you do that you message appears 
in the thread of the message you replied to.

It really messes things up for people who follow message threads. And 
worse you might not get any answers to your question since your question 
has nothing to do with the thread your posting now becomes part of.

To answer you question though:

I don't know of any short-hand for what you want to do. But this should 
work.

if ( ($idx != 1)  ($idx == 4)  ($idx == 9) ) {
   echo$results;
}

You could also look into using a regexp.

Jc

Liam Mackenzie wrote:
 Ok, I'm having a blonde day...
 
 If $idx == 1, 4 or 9 I don't want it to echo $results.
 I have this, what's the syntax to put multiple values in there?
 
 
 if ($idx != 1) {
 echo$results;
 }
 
 
 Thanks,
 Liam
 
 
 


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




Re: [PHP] Re: stupid question

2002-08-14 Thread Liam MacKenzie

Ok, point taken.
Sorry, I didn't know.

Also, thanks for the help, I got it  :-)


- Original Message - 
From: Jean-Christian Imbeault [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 15, 2002 1:52 PM
Subject: [PHP] Re: stupid question


Liam, when you want to post a new message to the list don't just hit the 
reply button and change the subject. If you do that you message appears 
in the thread of the message you replied to.

It really messes things up for people who follow message threads. And 
worse you might not get any answers to your question since your question 
has nothing to do with the thread your posting now becomes part of.

To answer you question though:

I don't know of any short-hand for what you want to do. But this should 
work.

if ( ($idx != 1)  ($idx == 4)  ($idx == 9) ) {
   echo$results;
}

You could also look into using a regexp.

Jc

Liam Mackenzie wrote:
 Ok, I'm having a blonde day...
 
 If $idx == 1, 4 or 9 I don't want it to echo $results.
 I have this, what's the syntax to put multiple values in there?
 
 
 if ($idx != 1) {
 echo$results;
 }
 
 
 Thanks,
 Liam
 
 
 


-- 
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: Stupid question

2002-05-02 Thread Henrik Hansen

[EMAIL PROTECTED] (Liam Mackenzie) wrote:

  I have a script that outputs this:
  0.023884057998657

  What's the command to make it shrink down to this:
  0.023

round()

-- 
Henrik Hansen

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




[PHP] A stupid question...

2002-03-10 Thread Chuck \PUP\ Payne

Hi,

I not a newie but I am not a pro at mysql either. I want to do a query by
letter(a, b, c..ect.). Is there a simple way to do it. I am writing in PHP.
So can someone please so me the how.


 
 | Chuck Payne  |
 | Magi Design and Support  |
 | www.magidesign.com   |
 | [EMAIL PROTECTED]   |
 

BeOS, Macintosh 68K, Classic, and OS X, Linux Support.
Web Design you can afford.

Hartley's Second Law:
Never sleep with anyone crazier than yourself.


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




[PHP] ... [PHP] Stupid question alert

2002-01-06 Thread tim at 10Kv


Thanks for everyone's comments. If I understand what you are saying it
should be possible to fill the content of a layer by issuing some sort of
server include command.. (?)  So, for example, rather than have a something
that looks like this:

div id=haiti style=position:absolute; left:752px; top:321px;
width:166px; height:162px; z-index:14; visibility: hidden
  table width=166 border=0 cellpadding=0 cellspacing=0
tr 
  td img src=Atlas/images/photolayer_11.gif width=81
height=55/td
  td img src=Atlas/images/photolayer_12.gif width=85
height=55/td
/tr
tr 
  td img src=Atlas/images/photolayer_14.gif width=81
height=53/td
  td img src=Atlas/images/photolayer_15.gif width=85
height=53/td
/tr
tr 
  td img src=Atlas/haiti_17.gif width=81 height=55/td
  td img src=Atlas/haiti_18.gif width=85 height=55/td
/tr
  /table
/div

It should be possible to have some code that gives the layer position but
rather than then having all the other code describing the layer contents,
have some sort of php command that says 'get the contents from file
xxx.php'. If this is the case what should I be learning about to make this
happen?

Thanks again,

Tim

(standing on the shoulders of giants)




 Your question is not stupid - it's just uninformed, and that's easily
 understandable if you never used PHP.
 
 The concept is dynamically creating the page SERVER-SIDE. That is, use some
 databases or some nifty code to dynamically build a page using specific
 parameters. Unforunately for you, this means that all the fun ends on the
 server
 side. Once PHP ends its job, Apache takes over and serves the content
 generated
 by PHP as it would serve any regular file. What you actually pass to the
 client
 is dead information - it's not dynamic unless you echo some JavaScript code
 or
 something similar from PHP (which is the same as writing the respective code
 in
 a regular file, unless you create some custom parameters in JavaScript based
 on
 some other parameters you pass to PHP).
 
 Hope my explanation makes sense... ;-)
 
 Bogdan
 
 tim at 10Kv wrote:
 
 Hi,
 
 first of all apologise to the list ­ this is a very basic question for you
 I¹m sure. I have tried to find an answer on the web but the problem is
 knowing HOW to ask the question ­ and I hoping you can provide me with a
 starting point.
 
 Anyway.. I design a lot of graphic intensive pages which rely heavily on
 layers that contain images, mouseovers and image swaps. The trouble is, when
 there are more than a couple of these layers on a page the code gets long
 and over complicated.  For example, if I have a page which on one side
 contains an image map with 5 clickable points that shows one of 5 possible
 layers on the other side of the page  (each with different content)  this is
 automatically a page with lots of code which is slow to load ­ especially if
 the page already has a layer based navigation bar!
 
 My question is: is there a way to use a language like php to make this
 process easier? For example populate the layers from a different file rather
 than have all the code on the same page and perhaps slim the page down a
 little ­ or is this missing the point of what a language like php is about.
 
 Thanks for your help and my apologies if this is the worst question of the
 week.
 
 Tim Rogers
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]