View Single Post
  #2 (permalink)  
Old March 17th, 2012, 10:42 PM
kenj kenj is offline
Authorized User
Points: 374, Level: 6
Points: 374, Level: 6 Points: 374, Level: 6 Points: 374, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2009
Location: San Jose, Californina
Posts: 77
Thanks: 4
Thanked 6 Times in 6 Posts
Default

Hi Master Yoda,

Here is what is supposed to happen.
When you click on "Post new message.", that
will bring up the add_post.php page.
The forum id number will be on the query string;
it will look something like this:
... add_post.php?fid=48
Type in a subject and a message, then click
"Create", that will bring up the page
view.php, which will also have the forum id number on the
query string, it will look something like this:
...view.php?fid=48
You should see a link to your message listed there
right under the "Post new message" link.
If you click on that message link you should see your message
and the date stamp should be on that message.

Now, let's look at what is happening when you run your code.
You said nothing is getting added to your database.
Try adding a couple of troubleshooting print statements
to add_post.php. First, see if you get in the if block where you
do the insert. Then print out the string $query and see if it looks
like what you expect.
PHP Code:
// add entry to the database if the form was submitted and the necessary
// values were supplied in the form
if (isset($_POST['submitted']) && $msg_subject && $msg_text)

Check the result of the mysql_query that does the insert. It will
return TRUE on success and FALSE on failure.

Check the error log file.


Now, there are some mistakes in this chapter;
see these posts.

Chap 2, add_forum.php, ~$user->permission is not working properly

Chap 2, Some small errors in add_post.php and view.php

Chap 2 forums, pagination issues page 55-56

Chap 2 - Avatars and uploading files, (would apply to Chap 6 too)

The forum is working for me, so you can
get it working.

I hope this helps.
Reply With Quote