For more information about how PHP inserts an image address string into MYSQL

Source: Internet
Author: User
For more information about how to insert an image address string from PHP to MYSQL, see shopex recently, the mysql database design field of ecshop is goods_imgvarchar (255). In this case, only 255 can be inserted. for details about how to insert an image address string from PHP to MYSQL
For details about how PHP inserts an image address string into MYSQL

I recently read the mysql database design of shopex and ecshop.

The field is goods_img varchar (255). In this case, only 255 characters can be inserted. at that time, I was a bit puzzled that I used PHP to insert data to the image location.

Address 'images/200905/goods_img/109g_1240902890755.jpg (this address is copied directly from their database. I used phpmyadmin

All of the above data is... If only copy and view the first image address is omitted, an error will occur when the number of inserted data records exceeds 6 in the string calculation, but they can be added in the background.

There are too many images. why is the mysql database automatically changing the type of this field ???


Can You Solve My doubts ??


------ Solution --------------------
Create a table to store image information, record each image, and provide the id of the product corresponding to a field. in this way, you can add any number of images under a product.
------ Solution --------------------
Mysql versions earlier than 5.0.3 are varchar versions later than 255 and have a maximum of 65535 bytes. the storage quantity of different character sets is not fixed.
------ Solution --------------------
The first time I met, I learned ......
I have never encountered any problems with varchar, and the mediumtext type can store and enlarge data.
------ Solution --------------------
There must be a limit on how many images can be added to the page.

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.