MediumInt field cannot be set to Nullable

In MySQL, I have a visitor_log table that looks like this…

------				-----	--------
id (UK)				No
member_viewed_id (P1)(FK)	No
visitor_id (P2)(FK)		No	0
ip				No
hostname			No
created_on (P3)			No
updated_on			Yes

Based on some previous advice, I was told that is it okay to store a NULL in the “visitor_id” field when someone is a non-registered Visitor.

In phpMyAdmin, I changed the “visitor_id” field to Null = “Yes” and left Default blank, but when I save the table phpMyAdmin is not accepting these changes?!

What is wrong?

And how do I make it so I can INSERT a NULL into the “visitor_id” field when logging a Non-Member Visitor? :-/



P.S. Because I used to INSERT a “0” for Non-Member Visitors, my table has tons of records with visitor_id = 0. But that shouldn’t matter if I am just trying to make the field Nullable?!

could you please do a SHOW CREATE TABLE and we’ll take it from there

it’s always best to get the actual mysql version rather than phpmyadmin’s interpretation

Based on my research, the problem seems to be that “visitor_id” is part of the Composite PK. (If it weren’t for that, things should work.)

With no other real options, I decided to create a “dummy” Member with an ID=0, and I changed my code so that I INSERT a “0” when a Non-Member is viewing a Member’s Profile.

So instead of looking for NULLS, I just look for zeros.

Seems to work.