Jump to content

Pulling data from database to directory


Revolution

Recommended Posts

We currently use this header code to pull data from WHMCS to our pages outside of WHMCS (everypage from within the public_html directory):

 

<?php

include("clientarea/dbconnect.php");

include("clientarea/includes/functions.php");

$link = mysql_connect($db_host,$db_username,$db_password);

mysql_select_db($db_name);

?>

 

But if we use the same code and put it a directory within public_html such as public_html/hosting/index.php we produce errors and it cannot locate the database.

 

<?php

include("http://www.domainname.com/clientarea/dbconnect.php");

include("http://www.domainname.com/clientarea/includes/functions.php");

$link = mysql_connect($db_host,$db_username,$db_password);

mysql_select_db($db_name);

?>

 

Any ideas would help right now.

Link to comment
Share on other sites

You need to use your paths, not urls to include the files, so it should look more like:

 

 

<?php

include("/clientarea/dbconnect.php");

include("/clientarea/includes/functions.php");

$link = mysql_connect($db_host,$db_username,$db_password);

mysql_select_db($db_name);

?>

 

OR

 

<?php

include("/home/username/public_html/clientarea/dbconnect.php");

include("/home/username/public_html/includes/functions.php");

$link = mysql_connect($db_host,$db_username,$db_password);

mysql_select_db($db_name);

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated