Jump to content

[SOLVED] mySQL database design question


CodeToad

Recommended Posts

I'm new to dynamic web design and am reading through David Power's book "PHP Solutions" so far so good.  The project purpose is that ultimatley I'd like to have a single database that I can add image information (like discriptions, file name, date, etc) and then have my website pull from that.

 

This database will get relativley large in terms of rows, 150+ and I want to be able to select and display the most recent 24 based on the date (integer 20070321 for example).  I was thinking of ways to do this in general language, like an if statement to compare dates and assign the greatest 24 to an array, but this seems intensive.

 

Is there a better way to do something like this or am I heading in the right direction?  Would a conditional statement comparing each of the 150+ records make the page slow to load for the user?

Link to comment
Share on other sites

I would very strongly recommend that you store dates in the ISO format - yyyy-mm-dd as a MySQL date field. It will make any date-related operations so much simpler than if you use an alternate or home-brewed date representation.  You can display the date in whatever format you want to, of course.

Link to comment
Share on other sites

Thanks :)  I'm new to databases but I'm familiar w/ VBa and VB.net, etc type programming.  I was thinking I had to call all of the information in the database and then use an if statement to determine the most recent dates, then assign them to an array.  Turns out there's a much easier way to do that as bg.anarchy showed me, and I had my dates wrong which andyb showed me :)

 

I'll check out those tutorials and links, the book I have has been good so far but it's starting to wear a little thin and I am finding myself searching the net for more material, so thanks for the links!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.