accidently posted in the hostings forum also

H

Happy Go Lucky

Guest
Discussion forum using php & mysql

Web based disscussion forum, possible with php & mysql?

Hi

I've got to pick a final year project, I'm ok with sql and learning php doesn't seem to daunting as I know basic html & general programming skills.


In your opinion how difficult would it be to do a
discussion board in php & mysql? (on gardening&plants would you believe) or even is it possible at all ? , it doesn't specify would you should use.


I have the option of doing a similiar project that displays info etc..
but the discussion board one defintely has the :cool: factor.

Mant Thanks
 
J

Jonty

Guest
Yes it is possible

Hi Happy Go Lucky

What you describe is possible, in fact our very own Tempy_Incursion has coded such a project himself in the past (and it's most impressive :) ). Due to the extensive nature of such projects, it is unlikely you'll find any tutorials etc on how to accomplish such a task. However, projects like these are as simple or as complicated as you choose to make them, with the more features you add the more sophisticated (and sometimes muddled) your code will get.

However, when you look at such projects already out there, the fundamental principles behind them are very easy ...

HTML Webform > (User inputs the data on the client side) > PHP (This data is then sent to the server, and handled via PHP) > MySQL (PHP sends the appropriate data to the MySQL database) > PHP (PHP returns the appropriate result to the user (e.g. A redirection to an okay or error message page) > HTML (The user sees the result).

Naturally many such projects now have some very sophisticated features, but the principles remain the same. And thankfully PHP and MySQL are a brilliant pairing. If you need any help on the specifics, please feel free to post here!

Kind Regards

Jonty

P.S. I took the liberty of deleting the post on the Hosting Forum, since your query really belongs here :)
 
H

Happy Go Lucky

Guest
Good:)

Am I better of designing my database first or learning php first?

Does BBcode have any relevance to me?

Can I have download link for mysql pls?

I assume I can use notepad for php!?!
 
I

Ivan.

Guest
Originally posted by Happy Go Lucky
Good:)

Am I better of designing my database first or learning php first?

Does BBcode have any relevance to me?

Can I have download link for mysql pls?

I assume I can use notepad for php!?!

I would suggest learning PHP first, as it will give you a better overall idea of how to approach the matter, and therefore how to plan the database out.

BBcode, or something along those lines, is something you may want to include, and it would be pretty straightforward to do the basic smilies etc with a simple string replace.

No.
Oh wait:
http://www.mysql.com/downloads/mysql-3.23.html
for the latest stable release.

And yes, you can.
 
J

Jonty

Guest
Hello

Well I can only speak from my own experience, which may not necessarily be the 'right' way to do things :) But anyway, in answer to your questions:
  • You will need a good understanding of PHP before embarking upon such a project, but once you feel comfortable with the language, you may wish to construct your DB first and then code your PHP afterwards (this is always how my projects have been commissioned).
  • BB code is something developers have dreamed up to make formatting messages easy for everyone, regardless of any HTML knowledge. It is very much an after though that can be added later on, and currently BB code is not an Internet standard.
  • MySQL can be downloaded from http://www.mysql.com so you can set it up on your local machine. BW itself already has MySQL installed, so you needn't concern yourself with setting it up here.
  • PHP, like any markup code, can be coded in any text editor, including Notepad. However, for ease us understanding, many designers prefer to use dedicated programs like Macromedia's Homesite (http://www.macromedia.com/products/homesite) to code (freeware equivilents are also available).

Hope this helps

Jonty

Edit - Ha! Looks like Ivan pipped me to it :)
 
S

Shocko

Guest
Some thoughts:

Firstly, if you're going to make your own forum, then you have to decide what kind of forum to make. There's the traditional mailing-list style forum, when you view posts individually, but see all posts grouped by thread. Then there's the modern style forum, such as this, where you view whole threads together, and have an index showing the various threads.

Next you need to decide what kind of usage system you want. Will you have a memberlist, where people "login" in order to post, or will people just enter their name/email and post, without having to register or anything(this is common with older forums).

Finally, you need to decide how complex you want the forum control to be. Will you just store people's posts unedited, and let them use html tags for message control? Perhaps you should use regular expression to filter out html that might be used for abuse(<script> etc)? Or will you change all < and > characters to their display codes in html(&gt; etc), and suply "forum code", that can be changed into html using regex.


Hopefully this has highlighted some issues specific to a web-based forum. I know of one person who used his own forum, however i reckon he was a bit of a coding guru, and his site and forum were asp based anyway :) I don't think it would be too difficult to create a _simple_ forum, using a mailing-list style layout, however it really depends on what you want to achieve. Letting people edit their posts, or delete them, for example, would represent the first major problem you'd have to deal with; However, you don't actually need this functionality, so it's up to you to decide what you want.

To sumarise, i think making your own forum would be a great thing to do, and i would certainly attempt it if i needed a forum for some reason, however i'd recommend you get used to php before you start work on it. Allthough PHP is designed to be almost like a server side extension of html itself, as a language it's basically just C, but with differant memory management(IE, easy variables).
 
J

Jonty

Guest
Some good comments Shocko. Well, I whole heartedly agree with them so they must be good ;) Seriously, though, as has been stated, producing your own forum would be a great feat, although you should be under now illusions as to the magnitude of the task.

Kind Regards
 
H

Happy Go Lucky

Guest
thanks , well it would have to allow users to logon and be a modern style forum

Or will you change all < and > characters to their display codes in html(&gt; etc), and suply "forum code", that can be changed into html using regex.

So using the display codes you can recognise them in php like ascii characters, and perform ops.also what is regex?


Can php be used to make a webform? I know vb can make forms but not web-based, and html itself -> tables, I think javascript &cgi has this functionality.

How much easier would it be to do it in asp? & would that mean I would have to use access?
 
S

Shocko

Guest
Regex is just short for regular expression. Basically, i meant that you would search through the user's post after they'd submitted it, and replace all occurances of the char '>' with '&gt;' which is the html to simply display one. This forum does it, so if i type <span>, it's converted into &lt;span&gt; which can be seen by looking at the source of this page. This will disable _all_ html :)

With respect to forms, you basically make a form with html, and set the action attribute to the php script that will deal with what's submitted. The elements of the form should all have a name attribute, which is how you access the submitted data in php.

Looking at this forum, the input box for my post is achieved using basically this: <textarea name="message">
In the php script that recieves my data, the body of my post can be accessed using the variable 'message', preferably through the new global arrays :)

PHP Itself offers no actual change to the html itself, it just lets you handle html, the webpages that make up your forum, will be displayed entirely using html; The php merely dictates what html is sent to you. If you're thinking of making a complex forum, then you really should look at some examples of forums first, because it will be a large undertaking. Go to http://phpbb.com/ and download the forum; Unpack it or whatever, and take alook at the source(PHP files). If it looks stupidly complex, then you proberbly shouldn't try to create your own forum.

I'll add this as well: If i wanted a forum, i'd do my own, using a mailing-list style layout, where you view posts individually. I wouldn't bother with a member system, or any of that BS, because it isn't needed for 70% of forums on the internet(Large places like BW are the exception). I'd perhaps filter out the <script> html tag, and just hope that no one feels like abusing my trust in leaving html possabilities. I'd perhaps include smilies, since they're the result of simple regex, but i wouldn't bother with things like message icons etc. I would include 2 possable views; One where you have 2 frames, one with the forum index, and the other containing the post you're currently viewing(ala the old PlanetFortress forum), and a 2nd viewing option where the posts opened up in the same frame as the post index.

In other words, i know exactly what i'd want, and i've a rough idea of how i'd achieve it - Wouldn't be too differant to a news script. Learning adequate PHP will proberbly take you a few weeks unless you're familiar with similar languages like C(visual basic is very differant afaik, more like shell script than C), so don't hang around if you have a deadline to meet. As Jonty has said twice allready, this would not be easy, the lack of differant forum systems on the web is testement to this. I'd say a forum is more something for an avid webcoder, who enjoys doing things himself, than someone trying to impress in some way.
 
H

Happy Go Lucky

Guest
Hi It's becoming less likely i'll proceed with a forum, but i'm still interested in looking at the source for the phpbb

here is the link for the downloads do I d/l the CVS snapshot?

I know basic c, by no means fluet & i'm determined to learn php, so I will still do something with php & mysql

I'm very appreciative of your help :)
 
S

Shocko

Guest
Yeah, any download of phpBB should do, even if it's really old. The fact that it's a 1.7meg download, suggests how much code is involved :)
 
T

Teaser

Guest
A forum in PHP / MySQL isn't difficult. If you properly plan out your database stucture and everything you want your forum to do now and in the future, then the PHP and SQL for this is relatively straight-forward.
 
I

insin

Guest
a quick note about replacing <, >, & etc....

the php function htmlentities() will take care of any encoding of this sort, saving you mucho worko :)

eg. if you have the message stored in $message, use:
$message = htmlentities($message);

I just finished making a better version of the A List Apart forums, which are basically a glorified upside down chatbox - so if you want to see what php can do without a database, have a look :)

http://www.dti.barrysworld.net/forum/
 
S

Shocko

Guest
Originally posted by insin
a quick note about replacing <, >, & etc....

the php function htmlentities() will take care of any encoding of this sort, saving you mucho worko :)
Bah, where's the fun in that :D
 

Users who are viewing this thread

Top Bottom