Web designing newb. Creating a PHP forum from scratch!

I need some urgent help please!

mainforumrp3.jpg


I've created the main forum and the form as above. I've used tables to make both of them and a few friends have opposed against them and they've highly recommend I start off with divs. I've been playing around for about an hour and i'm not making much progress. I've read up on the all the usual sites but I'm not making much progress. Any advice on achieving the layout above using divs instead of tables?
I've used a tutorial to create this for example purposes.
 
have a look at the html css for this http://www.phpbb.com/community/?sid=a84099e942ed9d9628cd6d759e8ce1a8

should help you get started, although personally i'd say its on the border of being done with a div's etc or tables. when you look at it you could say its tabular data in a way so using tables is semantically correct. but depening what info you have in the cells it could change.

Looking at the coding on the example I gave you should help, basically treat the rows as items in a list and create the collums as definition lists for topic, views, replies etc.
 
I've used tables to make both of them and a few friends have opposed against them and they've highly recommend I start off with divs.

Ignore anyone who tells you not to use tables for anything; they're completely missing the point. Tables should be used, unsurprisingly, for formatting data in a tabular fashion. As a forum index often takes this form, it makes perfect sense to use a table in this case.

You should use whatever element fits the situation semantically. Don't use tables for creating general page layouts – pages aren't tables. div elements should be used whenever there's no other element that would correctly describe what you're trying to do with it. For this reason, they're useful when creating page layouts.
 
Last edited:
Just use tables ;) CSS is better to use and tbh that is more of a layout than tabular data... so yeah, I can understand why your friends are telling you to use CSS. But I wouldn't bother if I were you :p If you've written your code nicely enough you can always come back to that later if you have time.
 
If you have a month to do this and nothing else (i.e. work and other assignments) you should have it done in no time.

I agree with what has been said above:

* DB Design first
* Get it functional
* Make it look right last - I find I spend most time doing this!

Good luck and keep us updated!

EDIT: and yes stick with tables to start with - so much easier to get basic layout right. If you have time spare at the end maybe play with making it using divs.
 
Am I correct in assuming tables and CSS don't work very well together?

If you have a month to do this and nothing else (i.e. work and other assignments) you should have it done in no time.
Unfortunately that is the problem. I've been working 2 jobs and as one of them I've been running a family business in absence of my brother. In addition I have 2 other assignment and a further 2 exams. I've also had family over. So I'm really struggling to cope atm but I'm trying to do what I can. Hopefully I should get a large amount done over the next 7 days as I've planned my time wisely!
 
Tables and CSS work fine together when used for their appropriate functions.

Tables should be used to display tabluar data, which I think is correct for a forum. CSS is used purely for layout and styling the page.

If you look at how this forum works everything is in tables that needs to be. If you have the Web Developer Toolbar for firefox have a look at outlining table cells.
 
Unfortunately that is the problem. I've been working 2 jobs and as one of them I've been running a family business in absence of my brother. In addition I have 2 other assignment and a further 2 exams. I've also had family over. So I'm really struggling to cope atm but I'm trying to do what I can. Hopefully I should get a large amount done over the next 7 days as I've planned my time wisely!

Ah... sounds like you have a lot on your plate! Good luck!
 
Hey guys, making a reasonable progress! I've gotten this far:

(Click for larger)


My reply part is a bit fubarred but I should have it resolved by tonight!

I'll appreciate any feedback/criticism! :)
 
Last edited:
I'll appreciate any feedback/criticism! :)
Yeah, you forgot to blank out those two Bookmarks Toolbar entries on the left hand firefox. I was expecting pr0n when I noticed the coverup. Imagine my surprise when they were perfectly innocuous :p

Looks like you're making solid progress. Just keep on adding functionality off the requirements you were given.

I like your layout, it looks simple and clean. As presentation aesthetics aren't mentioned in the requirements I'd leave any layout reworking till you have at least implemented the basic and easier advanced requirements.

Your code must be neatly formatted with proper indentation, meaningful variable, class and method.
Remember to make sure you do this while writing the code. If you leave it till later it will never happen!

I'd also recommend you put inline comments above blocks of functionality or any tricky problems/hacks as it makes reading through source files so much easier when you come to modify a file 2 weeks (or years) down the line.
 
Hahaha, owned :D

Just thought the dons would have a nosey and tell me off for having one that leads to competitors etc

Thanks for the feedback, mucho appreciated :)

My code is properly indented with meaningful comments and variables. Here's a snippet:

Code:
// get value of id that sent from address bar
$id=$_GET['id'];

$sql="SELECT * FROM $tbl_name WHERE id='$id'";
$result=mysql_query($sql);

$rows=mysql_fetch_array($result);
?>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF">
<tr>

You can also see some in the screenshot :)

I'll be needing some advice regarding registering users and transforming this baby into a proper forum!
 
I'm really struggling with an error I can't figure out.

I've added an if statement that does a sequence of commands else it echo's ERROR which it does and I can't seem to figure out what's going wrong.

PHP:
// Insert reply
$sql2="INSERT INTO $tbl_name(reply_id, a_id, a_name, a_reply, a_datetime)VALUES('$id', '$Max_id', '$a_name', '$a_reply', '$datetime')";
$result2=mysql_query($sql2);

if($result2){
echo "Successful<BR>";
echo "<a href='view_thread.php?id=".$id."'>View your reply</a>";

// If added new reply, add value +1 in reply column
$tbl_name2="create_thread";
$sql3="UPDATE $tbl_name2 SET reply='$Max_id' WHERE id='$id'";
$result3=mysql_query($sql3);

}
else {
echo "ERROR";
}

mysql_close();
?>


It's absolutely doing my nut in, as I've spent hours on it :(
 
Try:

Code:
$sql2 = "INSERT INTO '" . $tbl_name . "' ('reply_id', 'a_id', 'a_name', 'a_reply', 'a_datetime') VALUES ('" . $id . "', '" . $Max_id . "', '" . $a_name . "', '" . $a_reply . "', '" . $datetime . "')";

Edit: Also, change your error statement to this:

Code:
echo "ERROR: The SQL Server said:<br />" . mysql_error();

That should help you find the problem if the changed SQL query doesn't solve it.

Jon
 
Last edited:
Thank you for the response, when I replaced your code I got the following:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''create_reply' ('reply_id', 'a_id', 'a_name', 'a_reply', 'a_date

With my code and the error reporting, I got the following:

ERROR: The SQL Server said:
Duplicate entry '1' for key 1
:confused:
 
Back
Top Bottom