이 코드가 작동하지 않는 이유에 관해서 나는 혼란 스럽습니다. 나는 '회원'이라는 테이블이있는 'clubresults'라는 MySQL 데이터베이스에 데이터를 삽입하려고합니다. 보통 이런 종류의 물건은 나를 위해 꽤 쉽지만 아무 것도 데이터베이스에 나타나지 않습니다. 분명히 지금 xhostpp를 사용하여 localhost에서 이것을 실행하십시오. 아래 코드.등록 스크립트 PHP MySQL이 DB에 삽입되지 않음
Config.php에
<?php
// Connects to your Database
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("clubresults") or die(mysql_error());
?>
RegProcess.php - 홈페이지 PHP 클래스
<?php
include "config.php";
$Firstname = $_POST['Firstname'];
$Surname = $_POST['Surname'];
$Password = md5($_POST['Password']);
$Email = $_POST['Email'];
$insert = 'INSERT into members(Firstname, Surname, Password, Email) VALUES ("'.$Firstname.'", "'.$Surname.'", "'.Password.'", "'.$Email.'")';
mysql_query($insert);
?>
Register.php는 - HTML 양식을 유 전 $
을 넣어 깜빡
<form action="regprocess.php" method="post">
<table border="0">
<tr><td colspan=2><h1>Register</h1></td></tr> <br>
<tr><td>Firstname:</td><td>
<input type="text" name="Firstname" maxlength="60">
</td></tr>
<tr><td>Surname:</td><td>
<input type="text" name="Surname" maxlength="60">
</td></tr>
<tr><td>Password:</td><td>
<input type="password" name="Password" maxlength="20">
</td></tr>
<tr><td>Email:</td><td>
<input type="text" name="Email" maxlength="50">
</td></tr>
<tr><th colspan=2><input type="submit" name="submit" value="Register">
</form>
귀하는이 성명서에 mysql 오류가 나타나야한다는 삽입 문구에 일반 단어처럼 암호가 있습니다. – arma
동일한 scenerio 여기도) http://stackoverflow.com/questions/10509354/parse-error-syntax-error-unexpected-error/10509430#10509430 – nu6A
이렇게하면 SQL 인 경우 오류를 표시합니다. mysql_query 에러 ($ insert) 또는 die (mysql_error()); – bumperbox