Re: Problem with require_once
- From: Rik <luiheidsgoeroe@xxxxxxxxxxx>
- Date: Fri, 17 Aug 2007 17:22:36 +0200
On Fri, 17 Aug 2007 17:13:19 +0200, Shelly <sheldonlg.news@xxxxxxxxxxxxxxxx> 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= "the_server_location";
$database = "the_database_name";
$dbUsername = "the_username";
$dbPassword = "the_password";
$dbCon = 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 = "SELECT * FROM Company WHERE accountNumber='" . $num . "'";
$res = mysql_query($q, $con) or die(mysql_error());
$con <> $dbCon
$res = 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 this was
a strict cut and paste and the only keyboard strokes that I did were the the
slashes to comment out the require_once.
Hmmmz, I think the fault is elsewhere.
--
Rik Wasmus
.
- Follow-Ups:
- Re: Problem with require_once
- From: Shelly
- Re: Problem with require_once
- References:
- Problem with require_once
- From: Shelly
- Problem with require_once
- Prev by Date: Re: Two MySQL servers, one script
- Next by Date: Re: Need help sorting a XML file
- Previous by thread: Problem with require_once
- Next by thread: Re: Problem with require_once
- Index(es):
Relevant Pages
|
Loading