web statistics

CREATING A PHP POWERED FAQ SYSTEM

Step 3 - Writing the config
Ok in order for the faq system to work, we need a config,

a config file basically is the core of our faq system, which tells the system the main things it needs to know,

for example, where to insert to and how to connect to the database.

So make a new file called config.php and write the following:

<?php

$dbuser = "username"; // Username with permission to your database

$dbupass = "password"; // Password to the user

$dbname = "database"; // Database with sql tables in

$dbhost = "localhost"; // server host, usually localhost dont edit if unsure

So add that part first and edit what you need to, the dbuser being the username with permission to your database
$dbupass, password to the user and the $dbname being the Database with sql tables in, those variables above are going to define the connection, so once you have the code above in it lets put some more code in it.

Now we are needing to connect to the database so lets put this code in aswell:

mysql_connect("$dbhost","$dbuser","$dbupass");
mysql_select_db($dbname) or die(mysql_error());

?>

The code above basically means to connect to the database with the details you defined above.

So all together you should have:

<?php

$dbuser = "username"; // Username with permission to your database

$dbupass = "password"; // Password to the user

$dbname = "database"; // Database with sql tables in

$dbhost = "localhost"; // server host, usually localhost dont edit if unsure

mysql_connect("$dbhost","$dbuser","$dbupass");
mysql_select_db($dbname) or die(mysql_error());

?>

And thats our config.php done!


Pages: « First   1   2   3   4   5   6   Last »

Share del.icio.us Digg it reddit
Current tags

faq lja24 php powered sexy sql system
Rate this tutorial

4

Log In to rate this tutorial
Comments
PricelessNL on 04/03/07 at 12:38
hi, i found youre tutorial on the web when i was searching for a tut to create a faq. first i want to say nice tutorial :)
but i have a question. Is there a possibillity of a Edit.php page where you could edit the questions or answers if you made a error
Add Comment
Log In to post your comments

BannerFans.com
Google PageRank Checker - From PageRankr
 
&nsbp;