PHP Help.
Stuck on PHP? Ask it here. Show your code, your error, and what you tried — get a real answer, not a lecture.
This is a toy prototype. Questions are local-only — stored only in this browser tab. They are NOT saved to the server and NOT shared with anyone yet. Refresh = gone (unless this tab autosaves). Shared questions, accounts, and moderation are coming later. Don’t post passwords, API keys, or real DB credentials. Ever.
How it works (when it’s real)
Everyone asks in the same board. You ask, people answer, you mark the one that fixed it. Best answers rise, spam sinks. Cooldowns, accounts, and moderation will keep it useful. For now, you’re asking alone — practice asking well.
- Question = title + code + error + what you tried
- Answer = code that fixes it + why
- Mark solved when it works
- Download .txt to keep your thread
Community — coming soon
Shared state is not connected yet.
🟢 0 people asking right now (fake — local toy)
✨ Last question: —
✅ Last solved: — (not saved)
📜 Rules: Show code. Show error. No secrets.
⬇ Backend — PHP Help Backend — Template
Right now PHP Help is a tinker toy — questions is a local array in this tab, votes are local counters, answers are local, and Refresh = gone (except local autosave). Disclaimer is the truth: local-only, not saved, not shared. This backend is the map to make it real: one shared board, per-question writes, votes as server counts, answers as server rows, solved flag, cooldowns, accounts, moderation. Proposed, not connected.
01 / Files to create
api/phphelp/question.php POST /api/phphelp/question api/phphelp/questions.php GET /api/phphelp/questions?sort=new&tag= api/phphelp/answer.php POST /api/phphelp/answer api/phphelp/vote.php POST /api/phphelp/vote api/phphelp/solve.php POST /api/phphelp/solve sql/phphelp_tables.sql
Keep the tinyfiles PHP pattern: /api/bootstrap.php, json_in() / json_out(), prepared PDO. Dogfood it — this page is about PHP, so its own backend is the example.
02 / Database tables
-- sql/phphelp_tables.sql phphelp_questions id BIGINT AUTO_INCREMENT PRIMARY KEY user_id INT NOT NULL title VARCHAR(200) NOT NULL code TEXT NULL error_text TEXT NULL tried TEXT NULL tag VARCHAR(20) NOT NULL DEFAULT 'debug' php_version VARCHAR(20) NULL solved TINYINT NOT NULL DEFAULT 0 created_at DATETIME NOT NULL phphelp_answers id BIGINT AUTO_INCREMENT PRIMARY KEY question_id BIGINT NOT NULL user_id INT NOT NULL body TEXT NOT NULL code TEXT NULL accepted TINYINT NOT NULL DEFAULT 0 created_at DATETIME NOT NULL phphelp_votes question_id BIGINT NOT NULL user_id INT NOT NULL value TINYINT NOT NULL -- 1 up, -1 down PRIMARY KEY (question_id, user_id) phphelp_cooldowns user_id INT PRIMARY KEY last_question_at DATETIME NOT NULL questions_last_hour INT NOT NULL DEFAULT 0
Board is one shared feed. Never store a board per user — store only questions by id, plus answers and votes.
03 / API endpoints
POST /api/phphelp/question
{ "title": "Why is $_POST empty?", "code": "<?php ...", "error_text": "...", "tried": "...", "tag": "forms" }
- auth required, 1 question per 5 min
- validates title 5-200 chars, code < 5000 chars, tag in set
- strips secrets: never store passwords / keys — reject if found
- returns { "ok": true, "id": 123 }
GET /api/phphelp/questions?sort=new&tag=&since=
- returns { "ok": true, "questions": [ { id, title, code, error_text, tried, tag, solved, votes, answers } ] }
POST /api/phphelp/answer
{ "question_id": 123, "body": "Your form is missing method=post", "code": "..." }
POST /api/phphelp/vote
{ "question_id": 123, "value": 1 } — one vote per user per question
POST /api/phphelp/solve
{ "question_id": 123, "answer_id": 456 } — only asker can mark solvedAnswers are server rows — phphelp_answers — not client strings. Solved is a server flag.
04 / Cooldown, moderation & validation
// Cooldown: 1 question per 5 min, 1 answer per 30s, 1 vote per 2s // Moderation: no hate / NSFW / spam — mods can remove + ban user_id // Validation: title, code, error, tag — else 400 // Secrets: reject if code contains password / api_key / real DSN with password // Solved: only asker can mark solved, only one accepted answer per question
Keep disclaimer until this ships: “Tinker toy — not live yet. Refresh = gone.”
05 / Frontend wiring
// questions[] is already local. After asking (debounced 800ms): // POST /api/phphelp/question with new question // Poll GET /api/phphelp/questions?sort=new every 5s, apply only new questions // On load: GET /api/phphelp/questions -> load into questions[] // If API fails, fall back to local-only toy + disclaimer.
api/phphelp/ + sql/phphelp_tables.sql — no GitHub needed. Shared board, per-question writes, votes as server counts, solved flag, cooldowns + moderation.