php - Delete a database record and associated image -


i have table of photos this:

photo_id, photo_url, user_id 

when want delete photo, need delete row in table , photo on server. this, need 2 queries:

  1. a select query return photo's url , delete unlink()
  2. a delete query delete row in table

is simpler way this, perhaps using 1 query?

your way best way this....how can simpler....

also, if photos use ids may delete row instead of selecting query return photos url. if successful proceed deleting thumbnail


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -