How does one maintain the ID of an attachment database?

Source: Internet
Author: User
I would like to ask how the attachment database stores the relevant article ID. In general, the cms system or the mall system has an independent data table for their attachments. in my personal understanding, what about the past, put the image (attachment) in POST and upload it normally. First, write an SQL statement for the newly added & nbsp; article, and then obtain the mysql_insert_id () generated in this article, and then write it again & nbsp; add an attachment SQL. in the link article id, enter mysql_insert _. For more information, see the principle of saving the attachment database article ID.
General cms system or mall system
Their attachments all have an independent data table.

My personal understanding:
In the past, I put the image (attachment) in POST and used it for normal uploads,

First, write an SQL statement for the new article, and then obtain the mysql_insert_id () generated for this article ()

Then write the SQL statement for adding an attachment, and fill in mysql_insert_id () in the link article id to link the attachment with the article.

I used to do the same before.

But recently I think about it...
Now there are some uploadify, SWFUpload, and so on, and even some cropped imgAreaSelect, crop, etc.

They all Upload without post, and even I haven't processed the POST content to write SQL. these kits have helped me Upload things,

So I uploaded the file first. how can I know the attachment table of the relevant article?

Could you advise me?
------ Solution --------------------
After the plug-in is uploaded, the value is stored in a hidden field and submitted together during post.
------ Solution --------------------
Those are uploaded asynchronously... after you click start upload, a hidden form puts all the image paths you selected into the input node and submits them to the backend php. after processing, a hidden iframe is used to receive src, it is displayed to you and hidden input is generated to submit and bind these images together with the article src.
It's actually ajax.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.