RE: [PHP] Database Connections - permanent or something else?

2001-01-16 Thread mOrP

There's one thing, that I don't understand about permanent connections.

When will they be closed?
I could use a logout-page, but there is no garanty for the use of it.

Any explanation would be appreciated.

mOrP

> -Original Message-
> From: Ignacio Vazquez-Abrams [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 16, 2001 6:17 PM
> To: Sam
> Cc: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
> Subject: Re: [PHP] Database Connections - permanent or something else?
> 
> 
> On Tue, 16 Jan 2001, Sam wrote:
> 
> > Hi,
> >
> > I have several web pages that are built with php and mySQL.
> > I use a new connection for each script.
> > Should I be using a permanent connection? Or is there a better 
> way around
> > this?
> >
> > Regards,
> > Sam Rose
> >
> 
> Persistent connections are more efficient in that they don't need 
> to open the
> connection each time. Unless you have an overwhelming need to 
> limit concurrent
> connections to your MySQL server, you should probably be using persistent
> connections.
> 
> -- 
> Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>
> 
> 
> -- 
> 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]
> 

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




RE: [PHP] Two little questions

2001-01-14 Thread mOrP


> function check_alias_password()
> global $alias, $password;

better:

global $alias;
global $password;

> {
> if ((!$alias) || (!$password)) {
> header("Location: login.php");
> exit;
> }
> }
>
> check_alias_password();
>
> work? Or would the last example need to be globals (variables) instead of
> global?


Yes, this will work - with the correction I've made, 'cause I'm not sure, if
you can assign two variables to 'global'...

But you can see, that it is not good to use the 'global' keyword, because
you must know the name of the variable, you use.

Look:


$name_1 = "Jan";
$name_2 = "Fritz";

function print_name($name_arg)
{
    echo $name_arg;
}

print_name($name_1);
print_name($name_2);


You see, how flexible it is...

CU
mOrP


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




RE: [PHP] Two little questions

2001-01-14 Thread mOrP

James,

> function CUP (
> if ((!$alias) || (!$password)) {
> header("Location: login.php");
> exit;
> }
> );
>

usually a function has the following structure:


function  (  ) {  }


of course you can put any whitspace inside:

function  (  )
{

}

which makes it easy to read.

You can put anything you want inside a function, but you must know, that you
cannot directly access a variable, that is defined outside the function.


$name = "mOrP";

function print_name()
{
echo $name;
}

print_name();

will not work.

Then you must 'get' the global variables (like $name):


$name = "mOrP";

function print_name()
{
global $name;
echo $name;
}

print_name();


But it's better to work with the function arguments:

$name = "mOrP"

function print_name($name_arg)
{
echo $name_arg;
}

print_name($name);


notice, that there is no ";" behind the { ... } and the ( ... ) block in the
definition of the function.

Hope it helps,

mOrP.


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




[PHP] debugging php

2001-01-14 Thread mOrP

hello,

i need to debug php. usually i do this by using my own-written
debugger-class where i can turn off all output with a simple change of the
"on" variable.

well nevertheless now i need to trace the status and value of a variable
during runtime. this is impossible with this class. so i tried to use the
php debugger (php.ini: debugger.enabled =   True).

this leeds to some problems:
- what is a good tcp-listener (i tried tcpdump, but this gives to much
output)
- the debugger doesn't work: the command debugger_on("localhost"); leads to
the error-message shown below:

Fatal error: Call to undefined function: debugger_on() in index.php on line
2

... and the manual says, that the debugger is still under development.

does anyone know, how to debug php-scripts?

thanx for your help,

mOrP


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




RE: [PHP] Use

2001-01-13 Thread mOrP

Can someone point me to the documentation of ' -Original Message-
> From: Arcady Genkin [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, January 13, 2001 8:48 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Use 
>
> I have noticed that  in documentation, how safe is it to use it?
>
> Many thanks,
> --
> Arcady Genkin
> Don't read everything you believe.
>
> --
> 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]
>


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