Re: More include issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I thought that if you made a connection at the beginning of a page, that you
could use that connection throughout the page without having to type it over
again as long as you did not explicitly put in code to close the
connection??  Which is why I only inserted the include fil at the beginning
of the page.

Instead of having:

$connection = mssql_pconnect('SERVER','user','password') or die ('server
connection failed');
$database = mssql_select_db("database", $connection) or die ('DB selection
failed');

in my include file, I should only have $connection instead and then specify
$database before the query to the database.

Does that sound like the correct solution?

On 6/6/07, Richard Lynch <ceo@xxxxxxxxx> wrote:

On Wed, June 6, 2007 3:24 pm, Dan Shirah wrote:
> Yes, I have error_reporting = E_ALL and show_warnings = On.

Use phpinfo to confirm that, because...

> Here's something interesting...if I put the include directly above the
> code
> for the dropdown it works....like below:

> and then the code stops again at the next area of my page where it
> needs to
> connect to the database.

This sounds like a clear indicator that the problem is in your connect
script.

Aside: Having "../../" as part of the include path is a Warning Signal
for all kinds of settings, including open_basedir restirctions, and
also means you aren't leveraging include_path as you probably should.

> Since I have my database connection set as mssql_pconnect(persistent
> connection) I should not have to include the connection file before
> every
> attempt to retrieve something from the database, but that is the only
> way it
> is working right now.

That's NOT what persistent means at all...

PERSISTENT means:
"MySQL keeps my connetion around so it doesn't have to build a whole
new one the next time I connect"

It does NOT mean:
"I don't have to connect again"

PS
I also wouldn't recomment display_errors ON, but, rather, error_log ON
and make sure you can cause an error on purpose and read the error you
expect to see in the log file.

display_errors ON is only going to lead to trouble in the long run,
even on a dev box, with HTML masking errors and JS hiding erros, and
CSS not written to display errors leading to overlaid error output on
top of exected output, which makes both unreadable, and often
un-selectable for copy/paste without using "View Source"...

--
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/browse/from/lynch
Yeah, I get a buck. So?



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux