Mysql sets the phone field to be the only record that is inserted after a record is successfully inserted and then a phone number is inserted. Instead of returning an insertion error, sql statements report an error! What do I do

  mysql, question

Mysql sets the phone field to be the only record that is inserted after a record is successfully inserted and then a phone number is inserted. Instead of returning an insertion error, sql statements report an error! What do I do

$User=M('User');
 $result=$User->add($data);
 if($result){
 $da['code']='1';
 $da['message']= "registration successful";
 $da['token']=$data['token'];
 echo json_encode($da);
 }else{
 $da['code']='0';
 $da['message']= "mobile phone registered";
 $da['token']="null";
 echo json_encode($da);
 }```

There is no need for mysql to handle this. Check it before you put it into storage.