Forum Moderators: open

Message Too Old, No Replies

NOT NULL field randomly populates the letter a

NOT NULL field randomly populates the letter a

         

dwpub

9:14 am on Feb 18, 2009 (gmt 0)

10+ Year Member



Hi,

Background:

We have a small social networking site, that requires users to signup.

On the first form, they are only required to enter some basic information. i.e. Name, email address etc. Once submitted this information is stored in the database. They are then required to verify their account via email.

Once verified they can enter some more information about themselves.

The problem:

One of the fields in our database has been set to NOT NULL. However, this particular field is not present on the first stage of the signup process.

Therefore, No data or "" is entered into this field from the first stage.

Whats happening is the letter 'a' is being populated into this field.

I've looked through the code and cannot see how this is happening. The only thing I can think of is that the database is populating this data, as this field cannot be NULL.

Can anyone confirm this?

Please ask if you require more information.

dwpub

11:31 am on Feb 18, 2009 (gmt 0)

10+ Year Member



Solved

coopster

3:42 pm on Feb 18, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, dwpub.

Glad you got it sorted. Did you have a DEFAULT keyword on that column definition or something? Or was it indeed in the application logic where the value was being set?

dwpub

3:50 pm on Feb 18, 2009 (gmt 0)

10+ Year Member



Thanks for your reply,

Yes it seems it was a problem with application logic. In short this was happening:

$foo = add;

Further along in the script, I wanted the value of an array $foo['something']; because $foo['something']; didn't exist what was actually happening was the it was looking at $foo and taking the first value of the string which happens to be a.