I am currently writing a PHP script that will add a file to a MySQL data base. The php script is called from a form. The add function is sort of working properly, it is adding a blank line to the data base. Below is the code that I am using. $tablename is passed from an if statement.
function callconnection ($tablename){
$host = "server";
$user = "username";
$password = "******";
$dbname = "dbname";
@mysql_select_db("$dbname")
$link= mysql_connect($host, $user, $password);
$query = "insert into $tablename(cds) values ('$cdname')";
print("The query id:<br>$query<p>\n");
if(mysql_db_query ($dbname, $query, $link)){
print("The addition was successful<br>\n");
}else{
print("The addition failed<br>\n");
}
mysql_close($link);
}
any help as to what i might be missing will be greatly appreciated. I know the var from the form is in the $cdname var because i used an echo statement and it printed properly just for some reason it is not being added into the database, just a blank line.