Jump to content


Photo

This Day in History database retrieval


  • Please log in to reply
6 replies to this topic

#1 twebman

twebman
  • Members
  • Pip
  • Newbie
  • 6 posts
  • LocationCooperstown, NY

Posted 21 August 2006 - 07:57 PM

I have a "This Day in Baseball History" database. The fields are:

id, content, day, month, year

The content field holds the descrip of what happened that day. The other fields are self-explanatory. I want to add a field that will tag each event to a certain team, so I can display the results to have a "this Day in Tigers History" page and "Yankees" and so on... Some events might be fit more than one team. How can I create a field that has an identifier for both teams? For example, if it's an event I want to have on both the Tigers and Yankees pages, can I put "DET" and "NYY" in one field separated by a space? How do I retrieve it? I've tried LIKE and CONTAINS and neither works. Is there a way to do it that I'm overlooking?

Any help is appreciated.

#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 21 August 2006 - 09:00 PM

I personally would have a separate table with just two fields team_id and event_id.

then you can use an inner join to match up the events and the teams while keeping the database manageable.
follow me on twitter @PHPsycho

#3 theblain

theblain
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 21 August 2006 - 09:03 PM

I'm sure this isn't the BEST way of doing this, but you COULD create a couple "search" fields like keyword1 keyword2 keyword3, then "this day" would have to do with keyword 1 = giants keyword 2 = yankees..etc...

This would be a work around until someone who knows what they're talking about replies.

-theblain

#4 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 21 August 2006 - 09:05 PM

why store all that extra data when its not needed?
follow me on twitter @PHPsycho

#5 twebman

twebman
  • Members
  • Pip
  • Newbie
  • 6 posts
  • LocationCooperstown, NY

Posted 21 August 2006 - 09:26 PM

Thanks, ToonMariner... Will try that method. I've done a few INNER JOIN queries and I'll see if I can get this one to work.

THANKS!

#6 syed

syed
  • Members
  • PipPipPip
  • Advanced Member
  • 151 posts
  • LocationEngland

Posted 22 August 2006 - 01:03 AM

Would using javascript be a problem, you could have the 404 page redirect to the page you want, by adding the .html at the end of it. What I mean is get the url.


<SCRIPT LANGUAGE="JavaScript">

window.location="http://www.yourdomain.com<?php print $_SERVER['REDIRECT_URL']; ?>.html";
</script>

#7 syed

syed
  • Members
  • PipPipPip
  • Advanced Member
  • 151 posts
  • LocationEngland

Posted 22 August 2006 - 01:05 AM

Sorry guys, I dont know how I did it, but I replied to the wrong thread. Sorry.  ::)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users