简体   繁体   中英

php mysql default value of TEXT type on database

I am on a school poject doing a simple forum PHP & MySQL based. i just want to ask if i can set a default value like no_avatar.jpg on my database if the user dint uploaded a image file?

Yes Ron, you are right. BLOB/TEXT datatype can not have default value. BLOB and TEXT columns cannot have DEFAULT values.

Instead you should insert default value when inserting data into table.

Just check if user entered something, if not, just use default image name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM