updating/inserting data into multiple tables

A

Anonymous

Guest
I have a forum that is sorted by the last post (update) on each topic. This is of course so that the topics with the most recent update will go to the top.

My problem is that when a person replies to a topic, the "last update" table is not updated like it should. Here's the code:

Code:
mysql_query("INSERT INTO forum_posts (username,board_id,topic_id,post,date,last_update) VALUES ('$username','$board_id','$topic_id','$post','$date','$date')");
mysql_query("UPDATE forum_areas SET last_update = '$date' WHERE id = '$board_id");
mysql_query("UPDATE forum_topics SET last_update = '$date' WHERE id = '$topic_id");

after someone submits a reply, the above is executed. Everything seems to work except for updating forum_topics and forum_areas. What am I doing wrong?

Thanks,
Riley
 
mysql_query("UPDATE forum_areas SET last_update = '$date' WHERE id = '$board_id'");
mysql_query("UPDATE forum_topics SET last_update = '$date' WHERE id = '$topic_id'");

my suggestion, not sure if thats it though, ( ' ) after board_id and topic_id
 
Back
Top