Need a quick and dirty lesson display a database field on a page in SMF

Started by Stumpy, March 01, 2007, 01:39:44 PM

Previous topic - Next topic

Stumpy

Hi.

First, I have to say that Parham's lessons are great and I'm working my way through them (as well as through a couple books) as I find time.  By way of background, I've been a Windows guy my entire life and I'm currently recreating a site that I wrote (in asp) in php with SMF 1.1.2.  I am about as new to php and MySQL as any person can be, but I'm pretty good at making code do what I need if someone can just get me started.

That being said, I need to be able to display football schedules on a page in SMF, and I'd like for the users to be able to scroll backwords in time (2007 schedule, 2006 schedule, etc).  I've already built the database to hold all the relevant information, but I have no idea how to display it through php.  What I've done just to hold a space at this point is to take one of the basic pages from a mod and remove pretty much everything in the template file, replacing it with a simple HTML table (http://uffp2.com/tpsmf/index.php?action=schedule).  That will do for right now, but can someone just write an extremely simple test.template.php page that will draw a table in the appropriate place and insert a value from a database table?  It doesn't have to be anything fancy and you will be my hero forever.  I need to know how to do this because after I finish with the schedules page, I'll be basically using the same code for a rosters page, a standings page, a recruits page....you name it.

Thanks very much.

Stumpy

Okay, don't everybody jump in at once.  I figured it out.

Next question:  When connecting to a database in asp, you needed to make sure that the connection was closed after you were done querying.  Is this also needed with php and MySQL?  If so, how do I do it or is it already taken care of somewhere in the bowels of the SMF code?

kegobeer

The connection is automatically closed at the end of the php script.  You do not have to write code to close the connection, since there is no persistent connection.

Also, don't expect an immediate response.  It's customary to wait at least 24 hours before expecting a reply.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

Stumpy


Advertisement: