Create a Forum

  cornwall 20:42 11 May 08


I saw the following link from your forums:-
click here
and this gives all the necessary scripts etc.

I am encountering a few difficulties as I have never used php before.

I am receiving the following error when I click on the Submit button on screen create topic

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'northmiddluk'@'' (using password: YES) in /home/northmiddluk/public_html/add_topic.php on line 9
cannot connect

The full script of add_topic.php is below:-

############### Code
$host="localhost"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="forum_question"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// get data that sent from form

$datetime=date("d/m/y h:i:s"); //create date time

$sql="INSERT INTO $tbl_name(topic, detail, name, email, datetime)VALUES('$topic', '$detail', '$name', '$email', '$datetime')";

echo "Successful BR>";
echo " a href=main_forum.php>View your topic /a>";
else {
echo "ERROR";

I have amended the text inside the quotes on the following lines of the code

$host="localhost"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name

with their appropriate values

If you can help me solve this, it will probably help me resolve some of the other errors I am having


This thread is now locked and can not be replied to.

Surface Pro (2017) vs Surface Pro 4

20 groundbreaking 3D animation techniques

How to mine Bitcoin on Mac