Create a Forum

  cornwall 20:42 11 May 08
Locked

Hi

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'@'supanames-1-32.supanames.co.uk' (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
?php
$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
$topic=$_POST['topic'];
$detail=$_POST['detail'];
$name=$_POST['name'];
$email=$_POST['email'];

$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')";
$result=mysql_query($sql);

if($result){
echo "Successful BR>";
echo " a href=main_forum.php>View your topic /a>";
}
else {
echo "ERROR";
}
mysql_close();
?>


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

Thanks

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

Nintendo Switch review: Hands-on with the intuitive modular console and its disappointing games…

1995-2015: How technology has changed the world in 20 years

This abstract video touches on division in our technologic world

Best alternatives to iTunes for Mac | Best music players for macOS: Free your music from the…