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:
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
fetch
next_id
above, usepost_id
in insert query.
Comments
Post a Comment