$dbc=mysql_connect('127.0.0.1', 'root', '1234','aliendatabase')
or die('Failed!');
$query = "INSERT INTO alien_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')";
$result=mysql_query($query)
or die("Failed to upload!!!!");
mysql_close($dbc);
このコードは$結果行を実行できません(出力が失敗!!!!)が、接続を確立できます。私はテーブルの列の名前と変数をクロスチェックして、それは良いようです。PHPを使用してmysqlテーブルにデータを挿入する
MySQLバージョン5.7
**警告**:PHPを学んでいるだけの方は、[mysql_query'](http://php.net/manual/en/function.mysql-query.php)インターフェイスを使用しないでください。それはPHP 7で削除されたのでとてもひどいと危険です。[PDOのようなものは学ぶのが難しくない](http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps -pdo-for-database-access /)と[PHP The Right Way](http://www.phptherightway.com/)のようなガイドがベストプラクティスを説明しています。あなたのユーザーデータは**適切にエスケープされていない**(http://bobby-tables.com/php.html)であり、[SQLインジェクションのバグ](http://bobby-tables.com/)があります。悪用される。 – tadman
[エラーの性質についてもっと知る方法があれば] –
さて、私はそれを学びますが、なぜこのコードが動かないのか分かりますか?私はHead First PHP&MySQLという本を指していました。 –