I am trying to get the database to work and it is generating the following error:
POST Data couldn't be entered into the database
from the code below.
Two questions:
1. does this mean that:
$con = mysql_connect("localhost","mancroft","xxxx"
and
$db = mysql_select_db("$database"
are working alright?
2. what is wrong with:
#lets strip some chars and slashes
$name = stripslashes($name);
$name = htmlspecialchars($name);
$http = stripslashes($http);
$http = htmlspecialchars($http);
$msg = stripslashes($msg);
$msg = htmlspecialchars($msg);
$query = "INSERT INTO mytagboard(name,http,msg) VALUES('$name,$http,$msg')";
$result = mysql_query($query)
thanks.
................................................................................................
<?php
#change localhost to the sql server, user to the correct username, and pass to the correct
password
$con = mysql_connect("localhost","mancroft","xxxx" or die("Unable to establish a connection to the database."
#change database to the database name
$database = "mancroft_tagboard";
$db = mysql_select_db("$database" or die("Couldn't select database $database."
#lets strip some chars and slashes
$name = stripslashes($name);
$name = htmlspecialchars($name);
$http = stripslashes($http);
$http = htmlspecialchars($http);
$msg = stripslashes($msg);
$msg = htmlspecialchars($msg);
$query = "INSERT INTO mytagboard(name,http,msg) VALUES('$name,$http,$msg')";
$result = mysql_query($query) or die("POST Data couldn't be entered into the database."
echo "Click <a href='view.php'>here</a>.";
?>
POST Data couldn't be entered into the database
from the code below.
Two questions:
1. does this mean that:
$con = mysql_connect("localhost","mancroft","xxxx"
and
$db = mysql_select_db("$database"
are working alright?
2. what is wrong with:
#lets strip some chars and slashes
$name = stripslashes($name);
$name = htmlspecialchars($name);
$http = stripslashes($http);
$http = htmlspecialchars($http);
$msg = stripslashes($msg);
$msg = htmlspecialchars($msg);
$query = "INSERT INTO mytagboard(name,http,msg) VALUES('$name,$http,$msg')";
$result = mysql_query($query)
thanks.
................................................................................................
<?php
#change localhost to the sql server, user to the correct username, and pass to the correct
password
$con = mysql_connect("localhost","mancroft","xxxx" or die("Unable to establish a connection to the database."
#change database to the database name
$database = "mancroft_tagboard";
$db = mysql_select_db("$database" or die("Couldn't select database $database."
#lets strip some chars and slashes
$name = stripslashes($name);
$name = htmlspecialchars($name);
$http = stripslashes($http);
$http = htmlspecialchars($http);
$msg = stripslashes($msg);
$msg = htmlspecialchars($msg);
$query = "INSERT INTO mytagboard(name,http,msg) VALUES('$name,$http,$msg')";
$result = mysql_query($query) or die("POST Data couldn't be entered into the database."
echo "Click <a href='view.php'>here</a>.";
?>