>> -Original Message-
>> From: Dan Tappin [mailto:[EMAIL PROTECTED]]
>> Sent: Thursday, March 28, 2002 12:36 PM
>>
>> My only concern is that I am adding another mysql_connect and
>
> Why do it twice? The connection will still be there later in the script.
Yes... I realized that after I hit send :^)
>> I don't want to slow things down any (things are blazing fast now but I
>> want to keep it that way).
>
> It's not worth worrying about microseconds
That's what I figured.
>> It would be really nice if there was a one line function that
>> could do this. I also use Lasso and they have a simple
>> [URL_Redirect:'http://domain.com'] tag which does the job.
>
> You could write a function that does that like:
> function connect_to_db($host,$dbName,$user,$pass,$redirectTo) {
> $db = mysql_connect($host,$user,$pass);
> if (!db) {
> log(mysql_error());
> header("Location: $redirectTo");
> exit;
> }
> if (!mysql_select_db($dbname,$db)) {
> log(mysql_error());
> header("Location: $redirectTo");
> exit;
> }
> return $db;
> }
That is a really good idea. Now do I need to do something like this:
Blaa blaa blaa
>>
>> I am also unfamiliar with the output buffer functions even
>> after reading up on them in the manual. If I call ob_start()
>> at the start of
>> my page do I need to call a closing ob function after my $dbfail code if
>> the connection is successful and my redirect ob_end_clean(); call is
>> not made?
>
> No, ob_end* ends the buffering.
I still do not get the ob stuff. Is there any issue with having a
ob_start(); in my initial include and no ob_end* after this. I guess I
still really don't understand what is actual happening when I call
ob_start(). All I know if that I can then call the header function where
ever I want later.
I just want to know if I am creating any type security, or memory issue by
calling ob_start and then not calling ob_end*. I am going to take a guess
that when the server hits the end of the file the end is called anyway.
Thanks,
Dan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php