can't find error in user registration script *solved*
Posted: Mon Jun 11, 2007 2:33 pm
this is my script:
each time i put it in, it yields this:
Code: Select all
<?php
include 'error.php';
include 'dbconnect_silent.php';
$username = $_POST["username"];
$password = $_POST["password"];
$email = $_POST["email"];
$image = "";
$link1 = "";
$link2 = "";
$link3 = "";
$link4 = "";
if ($_POST['username']=='' or $_POST['password']==''
or $_POST['email']=='') {
error('One or more required fields were left blank.\\n'.
'Please fill them in and try again.');
}
// Check for existing user with the new id
$sql = "SELECT COUNT(*) FROM user WHERE username = '$_POST[username]'";
$result = mysql_query($sql);
if (!$result) {
error('A database error occurred in processing your '.
'submission.\\nIf this error persists, please '.
'contact you@example.com.');
}
if (@mysql_result($result,0,0)>0) {
error('A user already exists with your chosen userid.\\n'.
'Please try another.');
}
//insert the values
$result= "INSERT INTO userdata (userid, username, password, email)".
"VALUES ('NULL', '$username', '$password', '$email')";
if (mysql_query($result )){
echo "success in data entry!";
} else {
echo "could not insert data".mysql_error();
}
?>i noticed it is just cutting off the last piece of the code and displaying it as text. why is it doing this?0) { error('A user already exists with your chosen userid.\n'. 'Please try another.'); } //insert the values $result= "INSERT INTO userdata (userid, username, password, email)". "VALUES ('NULL', '$username', '$password', '$email')"; if (mysql_query($result )){ echo "success in data entry!"; } else { echo "could not insert data".mysql_error(); } ?>