The script is supposed to receive data from a HTML form and update the table based on the supplied information. This is what I get:
"Connected successfully
Selected successfully
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in on line 39
Query was empty"
<?
$name = $_POST["name"];
$show = $_POST["show"];
$first = $_POST["first"];
$second = $_POST["second"];
$third = $_POST["third"];
$fourth = $_POST["fourth"];
$fifth = $_POST["fifth"];
$sixth = $_POST["sixth"];
$first = $first* 6;
$second = $second * 5;
$third = $third * 4;
$fourth = $fourth * 3;
$fifth = $fifth * 2;
$sixth = $sixth * 1;
$total = $first + $second + $third + $fourth + $fifth + $sixth;
$dbhost = "dbhost";
$dbuser = "dbuser";
$dbpass = "dbpass";
$dbname = "dbname";
$conn = mysql_connect("$dbhost", "$dbuser", "$dbpass");
if (!$conn) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully<br />';
$select = mysql_select_db("$dbname");
if (!$select) {
die('Could not connect: ' . mysql_error());
}
echo 'Selected successfully';
$query = mysql_query("UPDATE nomsire SET show = $total WHERE name = '$name'",
mysql_real_escape_string($name,$conn));
mysql_query ($query,$conn) or die (mysql_error());
mysql_close($conn);
?>