I have a table called categoria with 10 rows:
(idcateg, descri) VALUES
(1, 'Action'),
(2, 'Classic'),
(3, 'Fight'),
(4, 'Others'),
(5, 'Puzzles'),
(6, 'Racing'),
(7, 'Shooting'),
(8, 'Sports'),
(9, 'Tower Defense'),
(10, 'Zombie');
and it's all linked to a page called link_categoria.php
<a href="link_categoria.php?cat=1">Action</a>
<a href="link_categoria.php?cat=2">Classic</a>
<a href="link_categoria.php?cat=3">Fight</a>
<a href="link_categoria.php?cat=4">Others</a>
...
What I want to know is, how can I have access to these pages so can I edit each one, because when I click on them it shows me the same result, it's linked like this:
mysql_select_db($database_gameconnection, $gameconnection);
$query_Recordset1 = "SELECT * FROM categoria ORDER BY categoria.descri";
$Recordset1 = mysql_query($query_Recordset1, $gameconnection) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
echo "Click a link and you will see all the games in the same categoria!<br><br>";
while ($row_Recordset1 = mysql_fetch_assoc($Recordset1))
{
echo '<a href="link_categoria.php?cat='.
$row_Recordset1['idcateg'] .'">'.
$row_Recordset1['descri']. '</a><br>';
}
I want to be able to edit the content of each category.
In your code, you only use one page and pass it a GET variable which is in fact the ID of the categoria. Therefore, you can't directly modify the content of a page.
However, a good solution would be to add (a) new field(s) into your table so that you can store the data you want to change for each "page" (each categoria).
When the user is clicking on the category you should send the category with in the url. Thenbyou make a page where you reffer the url to with the link to your category something like this. Yoururl.com/?category= the link were the player clicked on. Now on that page you are checking which category you got.Now you know the category you can echo the games