我在这里拉头发。我有一个用于数据输入和发布的 html 表单,insert_ac.php
但出现此错误:
警告:
mysql_query() expects parameter 1 to be string, resource given in /home/content/52/11733052/html/admin/insert_ac.php on line 24
这是来自的代码insert_ac.php
:
<?php
$username = "nlladmin";
$password = "password";
$hostname = "localhost";
$link = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
$selected = mysql_select_db("nlladmin",$link)
or die("Could not select Admin Database");
// Get values from form
$make=$_POST['make'];
$model=$_POST['model'];
// Insert data into mysql
$sql="INSERT INTO assets (make, model)VALUES('$make', '$model')";
if (!mysql_query($link,$sql))
{
die('Error: ' . mysql_error($link));
}
echo "1 record added";
mysql_close();
?>
任何建议都会有所帮助。