Page with index.php?id=1

jeef06 Posted messages 259 Status Member -  
Mihawk Posted messages 4753 Status Contributor -
Hello,

I would like to know how to create pages like: index.php?id=1
with ID calls from the SQL database?

This would be to separate news on different pages.

News 1 would be on the page: index.php?id=1
News 2 would be on the page: index.php?id=2
News 3 would be on the page: index.php?id=3
...

Thanks in advance

Configuration: Windows 7 / Firefox 7.0.1

2 answers

  1. DoulyCreations Posted messages 265 Status Member 19
     
    It should be something like:

    <?php
    if(!isset($_GET['id']))
    {
    include('default_page.php');
    }
    else
    {
    $Request = "SELECT * FROM news WHERE id = '".$_GET['id']."'";
    // Process Request and display the result

    // Check if the result is not empty: if(empty($Result))
    }
    ?>
    --
    When there’s a will, there’s a way! Or maybe not...
    1