On 8/26/12 9:32 PM, Kamal Palei wrote:
Hi Jamie Holly Thanks for kind reply.
You are right, I just deleted the entry and added a new entry in files table, it looks fine.
I have a small concern. The 'fid' column in files is of type serial. But I do not want unnecessary increment of fid values. For that purpose, while inserting new record, I am just making use of last fid value of that user. Code as below
db_query("INSERT INTO {files} (fid, uid, filename, filepath, filemime, filesize, status, timestamp) VALUES (%d, %d, '%s', '%s', '%s', %d, %d, %d)", $LastFID, $file->uid, $file->filename, $file->filepath, $file->filemime, $file->filesize, $file->status, $file->timestamp);
Hope I am not doing any mistake while re-using last FID value.
Regards
Kamal
NECS, Bangalore
One other option, is if the user has already updated a file, rather than deleting the database record and inserting a new one, do a replace or update query to change the existing one.
Reusing a deleted serial value should be ok too.