473,324 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

storing months in mysql 4

Hello, I'm using PHP 4 and MySQL 4. I want to store the month and year
as a single row but I am having difficulty figuring out the best data
type to use. I suppose I could use 'DATE' and then always have the day
value be equal fto 1, but I figure there's a more elegant approach. I
leave it to on e of you experts to recommend one.

Thanks in advance, - Dave

Jul 17 '05 #1
2 1269
NC
laredotorn...@zipmail.com wrote:

I'm using PHP 4 and MySQL 4. I want to store the month and
year as a single row but I am having difficulty figuring out
the best data type to use.
The best for WHAT? How do you intend to use the data? What
typical computations will be performed on it? What will it
be routinely compared to?
I suppose I could use 'DATE' and then always have the day
value be equal fto 1, but I figure there's a more elegant
approach.


Again, depends on how you are going to use the data. Maybe
for your purposes it makes more sense to set the date to the
last day of the month...

Cheers,
NC

Jul 17 '05 #2
On 29 Apr 2005 06:16:41 -0700, la***********@zipmail.com wrote:
Hello, I'm using PHP 4 and MySQL 4. I want to store the month and year
as a single row but I am having difficulty figuring out the best data
type to use. I suppose I could use 'DATE' and then always have the day
value be equal fto 1, but I figure there's a more elegant approach. I
leave it to on e of you experts to recommend one.


In the past, I've stored the month as an int representing "months
since Jan 2000", or some other "beginning of time" date.

HTH.

--
David ( @priz.co.uk )
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tom | last post by:
Hi, I'm designing a website that will use XML to store all the content of my web pages. I will use a PHP script to parse the XML. Should I store the XML in a MySQL database or should I simply...
5
by: Tencip | last post by:
Hi everyone, I'm trying to build a simple script that does the following. It should find today's month and year, and then go into a DB query string and look for all records that are from this...
8
by: Steven | last post by:
Hi there, I am wanting to store price data as n.nn format, so if the user enters "1" the data that gets stored is "1.00" Is there a way to do this. Cheers Steven
3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
0
by: Eben Goodman | last post by:
I am storing book isbn numbers in a table. isbn numbers are 10 digit numbers and many start with 0. The data type of the field I am storing this info in is a bigint(16) unsigned. It appears that...
8
by: Francesco Moi | last post by:
Hello. I'm parsing an XML file, and trying to store its contents into a MySQL database. But I've got problems. If I print the word before storing it, I get 'música' (OK). But if I store it...
7
by: Benoit St-Jean | last post by:
I am looking at options/ways to store 12 million gif/jpg images in a database. Either we store a link to the file or we store the image itself in the database. Images will range from 4k to 35k in...
3
by: hamvil79 | last post by:
I'm implementig a java web application using MySQL as database. The main function of the application is basically to redistribuite documents. Those documents (PDF, DOC with an average size around...
1
by: tomi.trescak | last post by:
Hi I have a problem with storing rich text in MySQL. I store rich text in MySQL (in column with type "text") which i get from Rich Textbox control. When i do reverse processing by trying to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.