尝试制作表格时出现此错误:
Parse error: syntax error, unexpected '}' in /srv/disk6/1346207/www/standingroomonly.co.nf/form.php on line 18
当我使用这个 php 时:
<?php
define('DB_NAME', 'myname');
define('DB_USER', 'myuser');
define('DB_PASSWORD', 'mypassword');
define('DB_HOST', 'myhost');
$link = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_selected_db(DB_NAME, $link);
if (!$db_selected) {
die('Can\'t use ' . DB_NAME . ': ' . mysql_error())
}
$value = $_POST['name'];
$sql = "INSERT INTO form (name) VALUES ('$value')";
if (!mysql_query($sql)) {
die('Error: ' . mysql_error());
}
mysql_close();
?>
如您所见,我正在尝试将名称文本框中的内容传输到 mySQL 数据库。但是当我按提交时出现错误!请帮忙!