php - Cms database licenses Structure -


i'm building big cms. there table called posts

her columns:

licenses_id post_id title

now want when user has licenses id example ssj1j221321 insert new post search on posts table last post_id have same licenses_id , insert post_id + 1.

how should it?

you can use query next post_id this:

  1. you can query next post_id of licenses_id this:

    select `post_id`+1 `next_id` `posts`  `licenses_id`='ssj1j221321' order `post_id` desc limit 1 
  2. fetch next_id above, use post_id in insert query.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -