#1
  1. No Profile Picture
    try a linux desktop today!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Vancouver
    Posts
    23
    Rep Power
    0
    I am trying to place the connect lines into a function in an include file. My problem is that one must reload the page to get it to run. I think I'm not calling the function properly.

    The function in the include:
    function connectToTree() {
    $link = @mysql_pconnect($hostname,$username,$password) or die("Unable to connect to database");
    @mysql_select_db("$dbName") or die("Unable to select database.");
    }

    The <?php inside html (login.php3):
    include ("connectToTree.inc");
    connectToTree();

    $query = ...etc.

    I actually get a 404 when I first call the page from the login form (method=get so I can retrieve their name). I refresh and it works as intended. Very puzzling... Similar behaviour in another page to which I've just tried to implement the include.

    Any comments appreciated.

    TIA,
    Jay
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    63
    Rep Power
    15
    This may be of no help but try using the require instead of include:

    require("globals.php3");

    ------------------
    ----------------------
    Ulysses J Ludwig
    Consultant
    Ujludwig@yahoo.com
    310.678.8324
  4. #3
  5. No Profile Picture
    try a linux desktop today!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Vancouver
    Posts
    23
    Rep Power
    0
    Good suggestion - learned the diff between include and require: include executes when read in and require reads in a function to be called upon later.

    Found out my problem was that the php went funky - ISP restarted and fixed it Had to write a Hello World script to prove php wasn't working...

Similar Threads

  1. Can't move or delete it!
    By Hykinsel007 in forum Windows Help
    Replies: 3
    Last Post: June 15th, 2004, 03:41 PM
  2. Replies: 55
    Last Post: June 14th, 2004, 10:02 AM
  3. Reading files that has certain parrent at once
    By cgi_pro in forum Perl Programming
    Replies: 2
    Last Post: January 29th, 2004, 10:13 PM
  4. how to rename files
    By dxgn in forum Perl Programming
    Replies: 1
    Last Post: January 1st, 2004, 01:10 PM
  5. How can I pack servlet files into a jar file?
    By suryahema in forum Java Help
    Replies: 1
    Last Post: December 18th, 2003, 08:32 AM

IMN logo majestic logo threadwatch logo seochat tools logo