Running multiple queries in php

后端 未结 2 1020
甜味超标
甜味超标 2021-01-22 16:29

I\'m really new in PHP and HTML. After pressing the submit button I\'m trying to populate the fields with the data that is already in the Users MySQL table (this works). I also

2条回答
  •  鱼传尺愫
    2021-01-22 17:03

    You are overwriting the variable $query with a new value instead of performing the query first. That said though your code has numerous problems:

    • You are not escaping $_POST['user_id'], please read up on SQL injection attacks.
    • You are not escaping your HTML, please read up on XSS attacks.
    • Your logic flow duplicates code
    • You are adding additional load on the database by fetching the data twice, only fetch once, and insert once.

    See the rewritten code below.

    
    
    
    
    
    
        
    
             PHP FIND DATA 
    
            
    
            
    
        
    
        
    
        
    Id:

    Osha #:

    First Name:

    Last Name:

    Company:

    Trade:

提交回复
热议问题