|
Posted by bapi on 08/19/07 12:52
On Aug 17, 8:13 pm, "Shelly" <sheldonlg.n...@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= "the_server_location";
> $database = "the_database_name";
> $dbUsername = "the_username";
> $dbPassword = "the_password";
> $dbCon = mysql_pconnect($hostname, $dbUsername, $dbPassword) or
> die(mysql_error());
> 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());
>
> 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.
>
> Does anyone have any ideas?
>
> Shelly
U can use required_once($_SERVER['DOCUMENT_ROOT']."dbLogin.php"); in
place of require_once("dbLogin.php");
Hope this will solve ur problem.
Navigation:
[Reply to this message]
|