0
我遇到了一个问题,我的代码似乎是正确的,并且正在查询或连接到我的数据库没有错误。 “ErrorNumber 0:...” 但是,当我检查phpMyAdmin它显然没有查询。我检查了所有的标题和表名,数据库名称和一切都很好。我的查询将不会运行或插入。这里是我的代码:Mamp phpMyAdmin表查询
mysql_connect('localhost', 'root', 'root', 'aliendatabase');
if (!$dbc) {
die('Error connecting to MySQL server.' . mysql_error());
}
$query = "INSERT INTO aliens_abduction(first_name, last_name, when_it_happened, how_long, how_many, alien_description, what_they_did, fang_spotted, other, email)" .
"VALUES('$first_name', '$last_name', '$when_it_happened', '$how_long', '$how_many', '$alien_description', '$what_they_did', '$fang_spotted', '$other', '$email')";
mysql_query($query, $aliendatabase);
echo "error number" . mysql_errno() . ": " . mysql_error() . "\n";
echo 'Connected Successfully';
mysql_close($dbc);