Jump to content

[SOLVED] Question on data types


weemikey

Recommended Posts

Hi all. I've done a bunch of reading online, but I'm still confused about what data types to use and more importantly how to do comparisons. I've just started php/mysql stuff and I'm starting to get it, but this one is killing me tonight.

 

Scenario: I have a field in my db that I want to be YES/NO. In other db's I've used that's a clear LOGICAL data type. If that exists in mysql I don't know what it's called. I want to have two fields in one table: "remember" (as in remember me...) which I'd like to be YES or NO. Same for "activated" which is used to check if someone has gotten a "click here to activate" email and followed through with the sign up process.

 

In my db I have these field set up as varchar with a default value of 'NO'. When viewing the table in phpmyAdmin the value is stored as 'NO' with the single quotes. Any other varchar data, such as an email address is stored just as it was entered without single quotes.

 

So when I'm doing some php stuff to compare values I don't know if I'm supposed to use single quotes or double quotes or NO quotes. I'm trying to compare things like "if this db field = NO", but I don't know if I'm supposed to use "NO", 'NO' or NO. Get it?

 

How can I set this up so the value is either YES/NO and I can refer to it like that? Does that make sense? I don't know if it's my db setup or my coding syntax. So confused!

 

 

Link to comment
https://forums.phpfreaks.com/topic/60498-solved-question-on-data-types/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.