Re: Problem with require_once



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
.



Relevant Pages

  • Re: Problem with require_once
    ... I have an include file for the connection information to the server. ... for it directly into the calling module, ... a strict cut and paste and the only keyboard strokes that I did were the ...
    (comp.lang.php)
  • Re: test button to validate mysql info
    ... Im unsure if A) it will work this way and B) how do even do this? ... Your PHP is back at the server. ... You *can* use AJAX or some other means of communicating with the server without submitting the form, using Javascript to send the request and process the response. ...
    (comp.infosystems.www.authoring.html)
  • Re: Problem with require_once
    ... bapi wrote: ... I have an include file for the connection information to the server. ... for it directly into the calling module, ...
    (comp.lang.php)
  • Re: Help with SUSE 9.0 Network Connection?
    ... Here, device type is shown to be PPPOE, server type is ... I am unsure to make all this work in Linux. ...
    (comp.os.linux.setup)
  • Remote Desktop to XP Pro through 2003 Server
    ... I have my 2003 server DC able to accept Remote Desktop connection over ... I can also RD into another XP Pro machine on the same domain. ... I am a bit unsure how you would go about adressing the XP Pro to make ...
    (microsoft.public.windows.terminal_services)

Loading