Need some help about dynamic sites

Discussion in 'PHP' started by beven, Oct 27, 2011.

  1. #1
    hi,
    I am looking to develop a dynamic sites. For which i have a home page & where i have many different links which is fetched from database. So in the root directory i also have a page in fact a common page where i want to display different things.. I have not href of that page. But i want to open that page every time when a link is click on my homepage.

    suppose i have link of 390 showing URL http://yourdomain.com/390.html I distort the url & get 390 to compare the values in respect to get form database. but i could not redirect page to open can some one explain it.

    Simply open a page or redirect a page.
    Thanks
     
    beven, Oct 27, 2011 IP
  2. HuggyEssex

    HuggyEssex Member

    Messages:
    297
    Likes Received:
    4
    Best Answers:
    2
    Trophy Points:
    45
    #2
    You need a script written that will collect the value from the $_GET value, it would be something like this if you are trying to collect the information from a database.
    
    if(isset($_GET['id'])) {
    $id = $_GET['id'];
    $result = mysql_query("SELECT `columns` FROM `table` WHERE id = '$id'");
    $array = @mysql_fetch_array($result);
    if(!empty($array['column'])) {
    header('Location:'.$array['column']);
    exit(0);
    }
    }
    
    PHP:
    I haven't tested that but should work you need to build the SQL query to match your database setup. If you are unsure post your code in here and I will try and help.

    Thanks, Glen
     
    HuggyEssex, Oct 27, 2011 IP
  3. beven

    beven Well-Known Member

    Messages:
    483
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    113
    #3
    Thanks for reply but where to use this code. In redirect file. if yes then from where we call redirect file.
     
    beven, Oct 31, 2011 IP