Ok heres the story. I'm building an online website (<< URL SNIP. Please read the rules. >> ) for graphics, and part on this site I'd also like to have forums. I figured out how to set up the site, Except I can't figure out the forums. I have the design up, I just don't understand how to let sumone be able to post, and have it store. And I also don't understand how to make it tell you who's online and who posted last. Please help me. And if anyone is VERY kind and will give me more help as I go along please leave your email, msn or aim.

Thanks

Dani AI

Generated

This thread asked how to let visitors post, persist messages, show who is online, and display the last poster. later noted the immediate problem was resolved; the following durable, stack-agnostic patterns and small examples make a forum easier to build, secure, and maintain.

A minimal relational schema (MySQL-style) that supports fast lookups and presence tracking:

CREATE TABLE users (
  id INT AUTO_INCREMENT PRIMARY KEY,
  username VARCHAR(50) NOT NULL UNIQUE,
  password_hash VARCHAR(255) NOT NULL,
  last_activity DATETIME NULL
);

CREATE TABLE forums (
  id INT AUTO_INCREMENT PRIMARY KEY,
  title VARCHAR(100) NOT NULL,
  last_post_id INT NULL
);

CREATE TABLE topics (
  id INT AUTO_INCREMENT PRIMARY KEY,
  forum_id INT NOT NULL,
  user_id INT NOT NULL,
  title VARCHAR(255) NOT NULL,
  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  last_post_id INT NULL
);

CREATE TABLE posts (
  id INT AUTO_INCREMENT PRIMARY KEY,
  topic_id INT NOT NULL,
  user_id INT NOT NULL,
  body TEXT NOT NULL,
  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);

Save/post workflow and integrity: wrap the insert and the topic/forum updates in a single transaction. Typical sequence: INSERT into posts, UPDATE topics (set last_post_id, updated_at), UPDATE forums (if keeping a global last_post_id), then COMMIT. Always use parameterized queries or prepared statements to prevent SQL injection. Escape or sanitize output when rendering body to prevent XSS, and store passwords with a strong hash (bcrypt/Argon2). Add rate-limiting and moderation steps to reduce spam.

Presence and last-poster queries (simple examples): treat a user as online when last_activity is within a short window (e.g., 5 minutes). Update last_activity on authenticated requests. Example queries:

SELECT username
  FROM users
 WHERE last_activity > DATE_SUB(NOW(), INTERVAL 5 MINUTE);

SELECT p.user_id, p.created_at
  FROM posts p
 WHERE p.topic_id = ?
 ORDER BY p.created_at DESC
 LIMIT 1;

Index topic_id and created_at for performance. UI tips: paginate threads, lazy-load long threads, and use AJAX polling or push (server-sent events/WebSockets) for live presence if real-time is desired. Log errors, monitor load, and favor small, testable steps when adding features so the forum stays reliable as traffic grows.

with the website put there it wasn't to advertise IF you visited the site you'd know. Theres nothing there. I just wanted to give people an Idea of my site. Sorry.

uh figured it out

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.