Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: PHP Assistance

  1. #1
    Euphonick Guest

    Default PHP Assistance

    Hello,
    I am working on a Webring for my website and I am having problems with the coding.

    I am working on the links to change between previous and next site, it currently just reloads the current page so I need your help.

    Here is my code:

    include('config.php');

    $id2 = $_GET['id'];
    $id = $id2 - 1;
    $output = mysql_query("SELECT * FROM webring WHERE id='$id'") or die();

    while ($row=mysql_fetch_array($output)) {
    $nextsite = $r['site_url'];
    }
    echo "<meta http-equiv=\"refresh\" content=\"0; url=$nextsite\" />\n";

    It looks fine to me, but it obviously isn't so if anyone can help please do.
    Thanks
    Nick

  2. #2
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    so, so where does it get $_GET['id']

    Plus if your using numbers

    say site 1

    then u call for site 0 ?

    im not quite sure how its supposed to loop threw it "/

  3. #3
    Euphonick Guest

    Default

    Well it gets id from the url so it will be something like ?id=1 then it adds or takes one off that so it will change to 2 then it will use that id and get the url from the database and redirect to that url.

  4. #4
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    anyway.

    I *think* it maybe that when u get the id to tsrat with, your pulling the one form the previos site, chnging it to - 2 would fix this if it were the case

  5. #5
    Euphonick Guest

    Default

    Well I managed to make it get the sites url from the database but now I can't get it to redirect to that url, if I use a meta redirect it just reloads the current page because it deosn't get the url and headers have allready been sent so I can't do a Header redirect.

  6. #6
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    shoulnt the php genirate before the meta refesh?

    you could always use a javascript redirect?

  7. #7
    Euphonick Guest

    Default

    Javascript deosn't support php I don't think, I tried anyway because I need to use a variable for the site url.

  8. #8
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    php creats a html page. then javascript makes the users computer chnage the page rather, thatn php doing it behind the seans "/

    php genirates all its stuff before anything is loaded to the uses computer, javaerscript, meta tags and all "/

  9. #9
    Euphonick Guest

    Default

    Well why won't the meta tag get the url? It just say's the variable in the html code so it has nothing to redirect to and just constantly reloads the current page.

    I sorted it now, it deos redirect.
    I am now working on making it go to 1 when your on the last site and go to the last site when your on 1.
    Also doing the Random site which I know how to do, I am trying to get the ID for the last site in the database but i'm trying to use a loop but that deosn't seem to work.
    Last edited by Euphonick; 15-05-2005 at 03:51 PM.

  10. #10
    Join Date
    Jul 2004
    Location
    Webby Forums!
    Posts
    1,879
    Tokens
    0

    Latest Awards:

    Default

    have you given the sites id's ???


    Chilimagik.net // Reviews, Band Biographies, News, Pics + Loads More!!
    [Thybag.co.uk - Vive la revolutione]

Page 1 of 2 12 LastLast

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •