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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -