Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 20th, 2004, 11:37 PM
Authorized User
 
Join Date: Sep 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default MySQL fields and booleans

I'm coming from using MS Access and I'm used to using boolean fields in tables for yes/no true/false responses.
I'm not even sure how this is stored.
I want to avoid a pit fall in a project I'm developing.
What kind of field type do I use for this in MySQL, so that I can use PHP code to get this yes/no value properly.
I'm a beginner at PHP, and MySQL, but am a full-fledge programmer and Database Analyst.

Salvatore
__________________
Database Agreements
 
Old September 21st, 2004, 01:24 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 1 Time in 1 Post
Default

Then field type is ENUM.
Then the Length/Set ('Yes','No').
John

 
Old September 21st, 2004, 12:24 PM
Authorized User
 
Join Date: Sep 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was thinking more along the lines that in MS Access the boolean is stored merely as a byte which is unsigned, and then internally it gets converted to a true/false. Ie. in code, you have
If fynReverseKey == False, etc.

In MS Access True=-1 and False=0 (I think).
Then in PHP 0 is false, and anything else is True right?,
so, if I use tinyint, then I just call the field,
fynReverseKey to indicate its a yes/no, which has the function of telling me whether a Reverse Key flag is set.
I guess I've solved my own problem!!







Similar Threads
Thread Thread Starter Forum Replies Last Post
subtracting two time mysql fields in php fochu PHP Databases 0 September 13th, 2006 08:17 AM
Single Quotes in MySQL fields Dave Brown Beginning PHP 1 June 10th, 2005 06:49 AM
MySQL Text Fields MAtkins General .NET 0 May 27th, 2005 03:17 PM
empty fields not hidden anymore (php/mySQL) jasmin Beginning PHP 1 January 17th, 2005 12:42 PM
mysql table fields in combo box knight PHP Databases 3 March 17th, 2004 09:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.