Jump to content

Msgboard: What's the best way to name the tables for my topics?


Recommended Posts

Hello,

I am passing variables in the url such as: ?board=54

Here is how I have my tables set up:

I have a table called boards, with the following fields:
boardno int NOT NULL, boardname varchar(30) NOT NULL, url varchar(30) NOT NULL, and the primary key is boardno

And the way I wanted to do it was to make an <html> table on the board index page listing all the different boards in the following format:

It would show the title of the board as a link. The url of the link would be topiclist.php?board= and then the value of the boardno in its record in the sql table.

I thought this would be an easy way to load the page that shows all the topics within that board, and the way I set out to do it was to select * from the table, whose name would actually be the value of the boardno. The only problem is that you can't create a table whose name is a number. So now I'm not sure exactly how I'm going to make it all smooth.

If that was confusing, let me explain it this way, I wanted the board list page to load all the records from the boards table. Then, I was going to append the boardno at the end of the url for that board such as topiclist.php?board=43 or whatever. I then planned on topiclist.php selecting all the records from the table whose name would be equal to the boardno variable that was passed to it in the url. I thought this would be an easy way to load all the topics into the list, if only you could name tables with numbers.

So how would a professional, experienced webmaster do this? What would be the most efficient way to have topiclist.php load all the records from the board whose id is equal to the variable passed to it in the url?

I tried to explain this the best I could. My server is:
Mac OS X
Apache
MySQL
PHP

Many thanks :D,
diode
Another advantage to the method I was trying to do would be that I could make each topic its own table, and then to keep the names different, I could just automaticaly increment the topic id.

Again, if I am very wrong on this whole thing, please enlighten me on this.

Thanks :D,
diode
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.