php - Query not inserting string data into table -
i trying insert data mysql database using php. code have works fine on localhost, when try on server reg_user_id, reg_user_access_level , reg_user_status inserted while other fields not.
please help, i've wasted day trying sort out.
everything here fine
the php is:
else { //sort data $reg_user_name = mysql_real_escape_string($_post['reg_user_name']); //create salt password before encryption, use same when retrieving password! $salt = 'mysalt';//not //first encryption $reg_user_password = sha1($_post['reg_user_password']); //second encryption salt $reg_user_password = sha1($salt.$reg_user_password); $reg_user_password = mysql_real_escape_string($reg_user_password); /*** strip injection chars email ***/ $reg_user_email = preg_replace( '((?:\n|\r|\t|%0a|%0d|%08|%09)+)i','',$_post['reg_user_email']); $reg_user_email = mysql_real_escape_string($reg_user_email); //connect db include '../-useful_scripts/php/mysqli_connect_dsnydesign.php'; //check connection if($dbc) { /*** check existing username , email ***/ $query = "select reg_user_name, reg_user_email reg_users reg_user_name = '{$reg_user_name}' or reg_user_email = '{$reg_user_email}';"; $result = mysqli_query($dbc, $query); $row = mysqli_fetch_row($result); if (sizeof($row) > 0) { foreach($row $value) { echo $value.'<br>'; } if($row[0] == $reg_user_name) { $errors[] = 'sorry, username in use'; } elseif($row[1] == $reg_user_email) { $errors[] = 'this email address subscribed'; } mysqli_free_result($result); } else { /*** create verification code ***/ $verification_code = uniqid(); //set query $query = "insert reg_users(reg_user_id, reg_user_name, reg_user_password, reg_user_email, reg_user_access_level, reg_user_status) values (null, '$reg_user_name', '$reg_user_password', '$reg_user_email', '1', '$verification_code');"; //run query if(mysqli_query($dbc, $query)) {
just goes on notify of submission after this.
check using same php version number on server , localhost. mysql_real_escape_string has been deprecated in latest version of php.
Comments
Post a Comment