我对 php web 开发很陌生,我在这段代码上停留了一段时间。目前数据只被输入到第一个表中。向正确的方向轻推将不胜感激。
$first = isset($_GET['first']) ? $_GET['first']: '';
$last = isset($_GET['last']) ? $_GET['last'] : '';
$email = isset($_GET['email']) ? $_GET['email']: '';
$pass = isset($_GET['pass']) ? $_GET['pass']: '';
$groupname = isset($_GET['groupname']) ? $_GET['groupname'] : '';
$grouppass = isset($_GET['grouppassword']) ? $_GET['grouppassword']: '';
define("DB_SERVER", "x");
define("DB_USER", "x");
define("DB_PASS", "x");
define("DB_NAME", "x");
define("TBL_USERS", "Members");
define("TBL_GROUP", "group");
function addNewUser($firstname, $lastname, $email, $password){
global $connection;
$password1 = md5($password);
$firstname = mysql_real_escape_string($firstname);
$lastname = mysql_real_escape_string($lastname);
$q = "INSERT INTO ".TBL_USERS." VALUES ('$firstname', '$lastname', '$email', '$password1','')";
return mysql_query($q, $connection);
}
$connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
mysql_select_db(DB_NAME, $connection) or die(mysql_error());
addNewUser($first,$last,$email,$pass);
$sql = mysql_query("INSERT INTO ".TBL_GROUP." VALUES ('$groupname', '$grouppass')");