I oops on the previous query, the proper ways are listed below.
My suggestion to this issue is to just make a new page with a simple INSERT and a simple form.
1st - Place your DB connection info in the same page and test if that works.
2nd - Use the include statement for your DB connection and test to see if your pages are working in that way.
If niether works, then it is your queries that are incorrect.
Proper SQL statements are:
$DBserver = "localhost";
$DBuser = "username";
$DBpass = "password";
$DBname = "dbname";
$dblink = mysql_connect($DBserver,$DBuser,$DBpass)
or die(mysql_error());
mysql_select_db($DBname,$dblink)
or die(mysql_error());
$sql = mysql_query("SELECT * FROM tablename",$dblink)
or die(mysql_error());
$row = mysql_fetch_array($sql);
if (mysql_numrows($sql)) {
echo "Do something";
} else {
echo "Unable to retrieve requested information";
}
$sql = mysql_query("INSERT INTO tablename (val1,val2) VALUES ('$val1','$val2')",$dblink)
or die(mysql_error());
$sql = mysql_query("UPDATE tablename SET val1='$val1', val2='$val2' WHERE id=$id",$dblink)
or die(mysql_error());
$sql = mysql_query("DELETE FROM tablename WHERE id=$id",$dblink)
or die(mysql_error());