I’m very new to web development (I have limited experience with HTML). I’m creating a debate website. Currently, each debate is stored in a MySQL database. When the user submits the information to the database, I want a new page to be created, that contains their debate, and the ability to comment and rate it.
The problem I’m having is that, from the research I’ve done so far, I’m not finding a solution to having a new web page for each debate. Does anyone have any suggestions on how to write the data to a unique web page??
Thanks,
George
Let’s assume you are using PHP and MySQL.
I will keep this very simple as possible probably need these files in a basic example plus your hopefull explanatory SQL tables (debates, comments, etc).
Form to CREATE A DEBATE
then that would send the form data to debateprocessor.php where we’d sanitize and prepit.
$_GET[‘action’]=”create” #this tells us we are creating the a debate
$_GET[‘debate_name’]=”SomeDebate”
debateprocessor.php – you’d want to to pull that in:
Note the action if($action == ‘foo’){ //do something; } statement – this would allow you to handle updates (comments, editing debate names etc) all in one file. other values for action in forms could be ‘edit’, ‘add_comment’ etc – you could have separate files to do all this but this allows you to do it all one. All you’d do is add on elseifs or other if statements like above for each action to modify a table.
So displaying your debates you’d have something like a master list of debates in a table, say you had
debatelist.php
That would output a list of debate names with a link to ea. debate_detail.php page for a given debate pulled by the PK, debate ID. In that file you’d use a similar combination of SELECT (ONLY USE ‘WHERE debate_id = ‘xyz’ and would likely JOIN tables like comments etc on debate_id=’zyx’ = debate_id=’zyx’.