简体   繁体   中英

how can i name a file uploaded with the new id record created

how can i name a file uploaded with the new id record just created in php and mysql, i am trying to identify files uploaded with their own id record generated by and auto-increment id field even if id are not in secuence. i have tried this :

$rs = mysql_query("SELECT MAX(id) AS id FROM $tb_1");
if ($row = mysql_fetch_row($rs)) {
    $id = trim($row[0]);

    }
    $id = $id+1;

but the problem is the last auto-incremente new id is differente in a secuence because i have delete last record and that change my view...

After your insert query, can you not do:

$id = mysql_insert_id();

That will store the ID in a variable for later.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM