You are here: Re: Problem with require_once « PHP Programming Language « IT news, forums, messages
Re: Problem with require_once

Posted by Rik on 08/17/07 15:22

On Fri, 17 Aug 2007 17:13:19 +0200, Shelly =

<sheldonlg.news@asap-consult.com> wrote:

> Here is a crazy question that has happend to me once before.
>
> I have an include file for the connection information to the server. =
It =

> is
> like this:
>
> $hostname=3D "the_server_location";
> $database =3D "the_database_name";
> $dbUsername =3D "the_username";
> $dbPassword =3D "the_password";
> $dbCon =3D mysql_pconnect($hostname, $dbUsername, $dbPassword) or
> die(mysql_error());

Are you very sure you need mysql_pconnect()? If you do not know exactly =
=

what it does are you are unsure, you clearly need mysql_connect().

> mysql_select_db($database, $dbCon);
>
> In my main file I have right near the top:
>
> require_once("dbLogin.php");
>
> I then have lines in a function where I pass in $sbCon as $con (The =

> quotes
> are single-double for the fist one and double-single-double for the =

> second
> one):
>
> $q =3D "SELECT * FROM Company WHERE accountNumber=3D'" . $num . "'";
> $res =3D mysql_query($q, $con) or die(mysql_error());

$con <> $dbCon

$res =3D mysql_query($q, $dbCon) or die(mysql_error());

> This gives me an invalid resource at the mysql_query line.
>
> HOWEVER, If I comment out the require_once line and copy and paste the=
=

> code
> for it directly into the calling module, it works fine. Note that thi=
s =

> was
> a strict cut and paste and the only keyboard strokes that I did were t=
he =

> the
> slashes to comment out the require_once.

Hmmmz, I think the fault is elsewhere.
-- =

Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация