mysql_insert_id with update

后端 未结 2 621
无人及你
无人及你 2021-01-29 12:34

After executing the query below I use the PHP function mysql_insert_id() and it always gives me 0.

UPDATE 
    tbl_training_types 
SET 
    fld_seri         


        
相关标签:
2条回答
  • 2021-01-29 12:59

    When you update a note in database you already have something using what you can identify it. In your example you already have $id which should be containing the value of data you have recently updated. If you don't have id and you try to update with name or something different after update you can simply retrieve updated data with simple query:

    select * from table_name where your condition
    

    Note: mysql_* functions are deprecated and won't be supported in future versions. You should be using either mysqli_* or PDO.

    0 讨论(0)
  • 2021-01-29 13:02

    Return Values

    The ID generated for an AUTO_INCREMENT column by the previous query on success, 0 if the previous query does not generate an AUTO_INCREMENT value, or FALSE if no MySQL connection was established.

    Source PHP Manual

    0 讨论(0)
提交回复
热议问题