search

Home  >  Q&A  >  body text

php - Questions about data table design?

You need to design a table to store images, including the path to upload the image, and the description. Each icon has two images, one style before clicking and one style after clicking. How to design fields elegantly? Please give me some advice, thank you!

大家讲道理大家讲道理2760 days ago621

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-06-08 11:03:51

    This doesn’t need to be stored in the database, right? Just put the images you want to use on the server and then reference them through css

    If you really want to save a database, let me give you the table structure for storing uploaded files in a project for reference:

    Field Type Null Key Default Extra
    id bigint(10) NO PRI NULL auto_increment
    contenthash varchar(40) NO MUL
    pathnamehash varchar(40) NO UNI
    contextid bigint(10) NO MUL NULL
    component varchar(100) NO MUL
    filearea varchar(50) NO
    itemid bigint(10) NO NULL
    filepath varchar(255) NO
    filename varchar(255) NO
    userid bigint(10) YES MUL NULL
    filesize bigint(10) NO NULL
    mimetype varchar(100) YES NULL
    status bigint(10) NO 0
    source longtext YES NULL
    author varchar(255) YES NULL
    license varchar(255) YES NULL
    timecreated bigint(10) NO NULL
    timemodified bigint(10) NO NULL
    sortorder bigint(10) NO 0
    referencefileid bigint(10) YES MUL NULL

    reply
    0
  • Cancelreply