Hey guys!
I was trying to write a new script for a user registration system, and I am running into an error. I am not even sure if the error is going to throw the script to failure really, but I just want to make sure that it is not anything fatal or something wrong in my scripting.
[php]
class ucp_cl {
var $open;
var $close;
function open() {
$this->open = mysql_connect(SQL_HST,SQL_USR,SQL_PWD);
mysql_select_db(DB_CBD, $this->open);
}
function close() {
$this->close = mysql_close($this->open);
}
function usrReg() {
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$userName = $_POST['userName'];
$userPassword = $_POST['userPassword'];
$userEmail = $_POST['userEmail'];
$userDOBM = $_POST['userDOBM'];
$userDOBD = $_POST['userDOBD'];
$userDOBY = $_POST['userDOBY'];
$regKey = $_POST['regKey'];
//$userTZ = $_POST['userTZ'];
$userTZ = "Yeah";
echo $firstName . $lastName . $userName . $userPassword;
// Make the data safe
$firstName = addslashes($firstName);
$lastName = addslashes($lastName);
$userName = addslashes($userName);
$userPassword = addslashes($userPassword);
$userEmail = addslashes($userEmail);
$userDOBM = addslashes($userDOBM);
$userDOBD = addslashes($userDOBD);
$userDOBY = addslashes($userDOBY);
$regKey = addslashes($regKey);
//$userTZ = addslashes($userTZ);
// Get user IP
$regIP = $_SERVER['REMOTE_ADDR'];
$curIP = $_SERVER['REMOTE_ADDR'];
$userTZ = "Whynot?";
$userRep = "1000";
$sql = "INSERT INTO ".TBL_USR." (userID,firstName,lastName,userName,userPassword,userEmail,userDOBM,userDOBD,userDOBY,regKey,regIP,curIP,actLocked,actBan,userAvatar,userSig,userTZ,userRep) VALUES (NULL,'$firstName','$lastName','$userName','$userPassword','$userEmail','$userDOBM',$userDOBD,$userDOBY,'$regKey','$regIP','$curIP',0,0,NULL,NULL,'$userTZ',$userRep)";
$result = mysql_query($sql);
if(!$result) {
echo mysql_error();
}
mysql_affected_rows($result);
}
}
[/php]
This is the script that is being run on user submit, and not it is not complete. the output from the script will give the warning, “Warning: mysql_affected_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\cbd\inc_cl\ucp_cl.php on line 65.” Now if I rememeber right, warnings will not kill the script (?), but they are annoying, and this is a test server, so I do not want to turn warnings or errors. The script is inserting the information into the users table correctly, but still throwing a warning.
Is there any mistakes with the code above? Thank you for any help!!
Adamm