Another way to include a php file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jace
    FBOP Class Of 2013
    • Jan 2004
    • 35562

    #1

    Another way to include a php file?

    i have this code I need to insert into my site:

    <?
    include "/directory/of/file/public_html/cnstats/cnt.php";
    ?>

    but when I do insert it creates some bad mysql errors.....is there a way to include this another way other than the way I have shown above?
  • mortenb
    Confirmed User
    • Jul 2004
    • 2203

    #2
    include("path/to/file"); and require("path/to/file");

    but it is unlikely that the way you are including has anything to do with your mysql errors.. it is more likely what is in the included file..

    Comment

    • AcidMax
      Confirmed User
      • May 2002
      • 1827

      #3
      You have to look at the other file too. It seems like it is accessing a mysql database, maybe with another include that has mysql functions?

      You could also try.

      chdir('/path/to/known/working/dir');
      include('./path/to/the/file');
      chdir('/current/directory/');
      Latest MMA news. http://www.mmawrapup.com

      Comment

      • Machete_
        WINNING!
        • Oct 2002
        • 14579

        #4
        It should work, I do the same on my one site.
        just put the relative (NOT absolute) path to it

        So if your indes is located in the root, and the cnt.php is located in the subfolder root/cnstats
        then it should look like this:

        <?
        include "cnstats/cnt.php";
        ?>
        Last edited by Machete_; 08-09-2005, 12:03 PM.

        Comment

        • Jace
          FBOP Class Of 2013
          • Jan 2004
          • 35562

          #5
          it has something to do with b2evolution

          everything works fine, except when someone is trying to access a url_that_looks_like_this....every other thing works, and the one thing that allows those urls to work again is removing that php code from cnstats

          Comment

          • Jace
            FBOP Class Of 2013
            • Jan 2004
            • 35562

            #6
            Originally posted by ebus_dk
            It should work, I do the same on my one site.
            just put the relative (NOT absolute) path to it

            So if your indes is located in the root, and the cnt.php is located in the subfolder root/cnstats
            then it should look like this:

            <?
            include "cnstats/cnt.php";
            ?>
            nope, that didn't work

            Comment

            • Jace
              FBOP Class Of 2013
              • Jan 2004
              • 35562

              #7
              Originally posted by AcidMax
              include('./path/to/the/file');
              that did it ;)

              thanks!

              Comment

              • AcidMax
                Confirmed User
                • May 2002
                • 1827

                #8
                Originally posted by JaceXXX
                that did it ;)

                thanks!

                Glad it helped.
                Latest MMA news. http://www.mmawrapup.com

                Comment

                Working...