I've been having this problem for a while and I cant find a fix around it now matter how hard I search. Basically in the old mysql I could assign a value to a text field automatically or I could just leave it blank now all that has changed.
When i do a query such as insert into
column1) values ('whatever')
It will not work if I have any other columns which are text fiends in the same table. So for example column2 is a text field and column3 is a varchar but because I didn't specifically assign values to them during my query, the entire query will fail. Is there any way around this. It becomes a big issue if I wish to change my database structure later. Adding just 1 extra field will make my entire site unable to function until I change every single insert query. There has to be a way around this, I'm almost 100% sure that the guys behind MySQL are not stupid enough to miss this issue.
Perhaps if you show the schema for a typical table you are having problems with, and an example sql statement that typifies this behaviour along with the error it throws, then that would provide a nicer illustration.
I suspect this is at its core this is an SQL question, but probably affects many PHPers.
I did provide an example. Read my post again and you'll see it. I provided an insert example and said if I have any other columns that are a text field asides from the one that I'm trying to insert. Nothing happens and I cant post. I did some extensive research. I'm not sure if this is true but apparently its a windows bug and on linux it gives a warning and processes the request by giving the text field a blank value but on windows it gives an error and doesn't process the request.
make sure those other columns have a DEFAULT value
if you post the results of a SHOW CREATE TABLE i can comment further
A default value can not be assigned to a text field that was the main problem I was having. In mysql 4.0 this would be solved by automatically assigning a blank value; and from what I read online, lynux will give a warning but wont stop the query and will also assign a blank value, this however isn't the case with windows. I'm not too sure if this is true as I do not use linux.
This topic is now closed. New replies are no longer allowed.