2021-08-11, 10:55 AM
I trying to handle SQL error for duplicate "name, surname" rows. Instead of error I need to redirect the user to other site. Is it possible?
![[Image: Lf6fy74.png]](https://camo.mybb.com/e6e6eeeefb3a3d8a6b382a4fa8fedc1ea9ccd4b0/68747470733a2f2f692e696d6775722e636f6d2f4c6636667937342e706e67)
My example that doesn't work:
My example that doesn't work:
$query = $db->query("INSERT INTO roleplay_characters(userid, name, surname, weight, height, birthdate, sex) VALUES (".$mybb->user['uid'].", '".$db->escape_string($c_name)."', '".$db->escape_string($c_surname)."', ".$c_weight.", ".$c_height.", ".$c_birthdate.", '".$c_sex."')");
$theError = $db->error_number();
if($theError == 1062)
{
echo("error");
}