doubledee — 2013-09-18T16:43:47-04:00 — #1
In MySQL, I have a visitor_log table that looks like this...
FIELD NULL DEFAULT
------ ----- --------
id (UK) No
member_viewed_id (P1)(FK) No
visitor_id (P2)(FK) No 0
created_on (P3) No
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?!
r937 — 2013-09-18T22:31:00-04:00 — #2
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
doubledee — 2013-09-18T23:00:39-04:00 — #3
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.
system — 2014-10-08T00:52:51-04:00 — #4
This topic is now closed. New replies are no longer allowed.