I know programming but I am pretty new in php. I am studying now some script and I cannot pass a config file. could anyone help me configuring a site.
the root folder is in d:/situri/agptg and the server folder is in d:/wamp/www/agptg and server address is http/localhost/agptg. And here is the config file

<?
/* 	Main Website URL
	This is the url to your website.
	*/
	define("TGP_WEBSITE", "http://www.yoursite.com/");


/* 	Build URL
	When ap|tgp creates static html files, it places them in a 
	directory on your server.  Designate that directory here, and
	be sure to include the trailing slash /.
	*/
	define("TGP_WEB_PUBLISH", "http://www.yoursite.com/site/");


/*	Build Dir Path
	You entered a URL above which designated the placement of 
	static html files.  Specify that directory here again, but in 
	server path form, and be sure to include the trailing slash /.
	*/
	define("TGP_HTML_PATH", "/web/sites/you/yoursite.com/public_root/site/");


/*	ap|tgp Script Directory URL
	ap|tgp has a few php scripts that you will want publically 
	available.  This includes webm_submit.php, webm_stats.php, 
	etc.  ap|tgp needs to know the URL to the directory that will
	hold these files. Be sure to include the trailing slash /.
	*/
	define("TGP_APTGP_URL", "http://www.yoursite.com/aptgp/");


/*	ap|tgp System Dir Path
	This is the server path your sfiles directory for ap|tgp. Be 
	sure to include the trailing slash /.
	*/
	define("TGP_SFILE_PATH", "/web/sites/you/yoursite.com/public_root/aptgp/sfiles/");


/*	ap|tgp Include Dir Path
	This is the server path your include directory for ap|tgp. Be 
	sure to include the trailing slash /.
	*/
	define("TGP_INCLUDE_PATH", "/web/sites/you/yoursite.com/public_root/aptgp/includes/");


/*	ap|tgp Log
	This is the server path your ap|tgp log file.
	*/
	define("ERROR_LOG_FILE", "/web/sites/you/yoursite.com/public_root/aptgp/sfiles/tgp_error.log");


/*	ap|tgp Fast Logging
	Set to true to add an initial file stage to your statistical 
	logging.  This should be set to true unless your database does
	not support LOAD DATA INFILE.
	*/
	define("FAST_LOG", true);


// DB Server
	define("TGP_DBSERVER", "11.111.11.111");
// DB Name
	define("TGP_DBNAME", "tgp_db");
// DB username
	define("TGP_DBUSER","webuser");
// DB password
	define("TGP_DBPASS","p9ssw0rd");
?>

Recommended Answers

All 10 Replies

you need to either call it in a function or use it as a variable. I have written it for you here

<?

// You can also write the name here instead of the constant
// just enclose it with double speech marks
$host = TGP_DBSERVER;
$userName = TGP_DBUSER;
$passWord = TGP_DBPASS;
$dbName = TGP_DBNAME;
// Change these two suit and upload the file
$tableName = "ENTER YOUR TABLE NAME HERE";
$mainField = "ENTER ONE FIELD YOU WANT TO SEE EG NAME";
$secField = "ENTER ANOTHER FIELD NAME HERE";
//Connect to your database
$connect = mysql_connect("$host","$userName","$passWord");
// this will out put the error
if (!$connect)
{
die('Could not connect: ' . mysql_error());
}
//this will output a success message
if ($connect)
{
echo"<br>Yay it works. you are CONNECTED! There should be results below. If not, check there are records in your database.<h1>Welcome to the world of PHP/SQL</h1><br>";
}
//select the database
mysql_select_db("$dbName", $connect);
// put your sql statement here below this line
// i have made a default one for you, change the $tableName and field variables
// at the top and it will display results.

$result = mysql_query("SELECT * FROM $tableName");
//display every result

while($row = mysql_fetch_array($result))
// a while statement will run until every record has shown
{
$showA = $row." | ";
$showB = $row."<br>";
}
// and close your database
mysql_close($con);

?>

The if statement below will output the error.
The while statement will run until every record is shown, you can add a where statement to get certain records from your database.

Please post the error if you recieve one or mark this thread as solved and upvote (top right corner of this post) this comment please if all fine.

oop's that was posted twice

Are you declaring the constant as an echo or variable?

$var = TGP_WEB_PUBLISH;
echo TGP_WEB_PUBLISH;

What error is it saying? Im not too sure im on the same page. are you having trouble connecting to your database or to the file.

if it is to the file then you need to include it like this:

<?
include("config.php");
?>

@gotboots, wrap the codes with

[/B] tag.

[B]@eduard77[/B], what do you want to config ? In config file, there are some constants and their values. You can easily edit the value of the constant what you want. For example, if you want to change the site url. You might change this line:
[code=php]
define("TGP_WEBSITE", "http://www.yoursite.com/");

to

define("TGP_WEBSITE", "http://www.mywebsite.com/");

http://www.mywebsite.com/ is the new value of the "TGP_WEBSITE" constant.

You can also change the constant name, in this condition "TGP_WEBSITE", to another as you like. But, if the constant may use in another file of this system, so if you want to change, ensure that all TGP_WEBSITE within all files might change together.

oh oops still learning this forum stuff.

hello world

The problem is here
define("TGP_SFILE_PATH", "/web/sites/you/yoursite.com/public_root/aptgp/sfiles/");
my server folder is d:/wamp/www/aptgp/public_root/aptgp/sfiles/ but this is not working
define("TGP_SFILE_PATH", "d:/wamp/www/aptgp/public_root/aptgp/sfiles/");

yes you are right

Marks as Solve with the link below the text box if the problem solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.