Quote:
Originally Posted by Marco van Herwaarden
The default value for a column as set in MySQL will probably not work in many PHP scripts as these tend to provide a value for each column inserted, even if it is just a blank string (ie. ''), so the default is never used as a value was submitted.
But why not just create a vB Setting to let the admin define the default and use this when inserting the rows?
|
Well, I don't have a hook off "Add Member" to give credits so the way I have been giving users credits is through the default MYSQL value for the credits field. It works fine like that but some sites want to change the default value and some people don't have access or skill to use myPHPAdmin to
update the default value.
This may well be a limited use sniped of code, but I tested it on a couple of my sites on different servers and it seems to be working so I am going to try this route for now. This should be a value that is only changed say once at most.
I use PHP to update the field attributes and that works fine, the issue was getting what the current setting was and the code above gives me that.