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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -