Thread: PHP Jump Script

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Toronto, Ontario, Canada
    Posts
    19
    Rep Power
    0
    Hey all, this is my first post although I have been browsing for quite some time I am just looking for some help with my jump.php3 script that I will post below. It grabs the info from another script called coupons.php3 but I can't get it to go to the URL that it grabs instead it just displays the URL on the page.
    <?php

    $link = mysql_connect ("", "username", "password");
    mysql_select_db ("databasename");

    $result = mysql_query ("SELECT link FROM links WHERE number=$locn");
    $row = mysql_fetch_array($result);

    echo "Location: location nnn";
    echo $row["link"];

    mysql_close ($link);
    ?>


    any help/comments would be greatly aprecited thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Niteroi, RJ, Brazil
    Posts
    30
    Rep Power
    15
    try this:

    header("Location: " . $row["link"]);

    and before any html tag

    you're using echo and writing a location after the LOCATION header.

    Try it out.

    ------------------
    Eduardo Teixeira Cardoso
    PHP Programmer from Brazil
    idnotfound@vircio.com.br
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    London/UK
    Posts
    91
    Rep Power
    15
    Spot on

    make sure there is no whitspace after you last ?> tag, else you'll get a nasty (but informative) error telling you that you cannot send header info after a page has loaded. php will take a PRINT or as IDnotfound says <HTML> tag as output to the screen and therefore barf

    Bealers

    ------------------
    http://back-end.org
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Toronto, Ontario, Canada
    Posts
    19
    Rep Power
    0
    Thanks everyone who replied I went with the line
    header("Location: " . $row["link"]);
    and it seems to work fine.

Similar Threads

  1. php script won't work inside "cgi-local" directory
    By Volitics in forum PHP Development
    Replies: 5
    Last Post: April 26th, 2004, 10:50 PM
  2. How to see the Memory used by a PHP script?
    By Pardall in forum PHP Development
    Replies: 4
    Last Post: February 13th, 2004, 03:54 PM
  3. Change this PHP script to use NETPBM instead of GD
    By hknight in forum Project Help Wanted
    Replies: 1
    Last Post: February 10th, 2004, 11:46 AM
  4. Replies: 1
    Last Post: February 4th, 2004, 01:39 PM
  5. Executing PHP script using crontab with PHP module
    By crazyIvan in forum PHP Development
    Replies: 0
    Last Post: January 23rd, 2004, 08:27 AM

IMN logo majestic logo threadwatch logo seochat tools logo