find duplicate addresses in database, stop users entering them early?

前端 未结 15 1267
长发绾君心
长发绾君心 2021-02-04 05:13

How do I find duplicate addresses in a database, or better stop people already when filling in the form ? I guess the earlier the better?

Is there any good way of abstra

15条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-04 06:05

    As google fetch suggesions for search you can search database address fields

    First, let’s create an index.htm(l) file:

        
        
    
        
            
            Address Autocomplete
            
            
            
            
            
            
            
    
        
        
    
        
            

    Try it yourself

    Now we will create a city.php file which will aggregate our query to MySQL DB and give response as JSON. Here is the code:

     $row['city'].', '.$row['zip'],
                'value' => $row['city'],
            );
        }
        //RETURN JSON ARRAY
        echo json_encode ($array);
    }
    
    ?>
    

    and then prevent saving them into database if found duplicate in table column

    And for your addressexists.php code:

    
    

提交回复
热议问题