Results 1 to 5 of 5
  1. #1
    "An Englishman In New York" TJ's Avatar
    Join Date
    January 18th, 2005
    Posts
    3,282
    Just wondered if anyone could pick fault with this code... potential problems etc?

    TIA!!

    <pre class="ip-ubbcode-code-pre">
    &lt;?php
    require ("connect_db.php");

    // Find buy_url from variable item //

    $query = mysql_query("SELECT item_buy_url FROM mytable WHERE item = '$item");
    $rows = mysql_num_rows($query);
    while ($url = mysql_fetch_array($query))
    {
    $go = $url['item_buy_url']);
    }

    // determine if a valid item was passed and redirect accordingly //
    if($rows &lt;&gt; 1)
    {
    header("Location: http://www.mydomain.com/oops.html");
    } else
    {
    header("Location: ".$go."&afsrc=1");
    }
    mysql_close($db);
    ?&gt;</pre>

  2. #2
    ABW Ambassador sjangro's Avatar
    Join Date
    January 18th, 2005
    Location
    Boston
    Posts
    1,529
    TJ,

    at a glance, the PHP code all looks fine.

    However, if I understand your intentions for this correctly, which is to redirect to an affiliate link, there's no need to put the afsrc parameter on there.

    You want to put the afsrc=1 parameter on the link that calls this:

    yourdomain.com/jump.php?item=123&afsrc=1

    That's the visible link that gets clicked and the one that needs the afsrc label to be identified as an affiliate link.

    --scott

    --
    scott@befree.com

  3. #3
    "An Englishman In New York" TJ's Avatar
    Join Date
    January 18th, 2005
    Posts
    3,282
    Hi Scott... Long time no speaky

    [This message was edited by Tj© on July 23, 2003 at 05:51 PM.]

  4. #4
    ABW Ambassador FFoc's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,015
    if you are going to
    <pre class="ip-ubbcode-code-pre">
    if($rows &lt;&gt; 1)
    </pre>
    you should SELECT DISTINCT...

    --
    "The greatest good you can do for another is not just to share your riches, but to reveal to him his own." – Benjamin Disraeli
    --
    Ford Fox-body Owners Club -- http://www.ford-fox.org

  5. #5
    "An Englishman In New York" TJ's Avatar
    Join Date
    January 18th, 2005
    Posts
    3,282
    yeah, I was gonna do a limit 1 Ty both

  6. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. open new window while using jump.php
    By Knothead in forum Programming / Datafeeds / Tools
    Replies: 9
    Last Post: December 29th, 2006, 07:08 PM
  2. Need PHP Affiliate Jump Script for CJ
    By trev0006 in forum Commission Junction - CJ
    Replies: 0
    Last Post: October 27th, 2006, 04:58 AM
  3. How to do <a> tag type bookmarks in php?
    By Donuts in forum Programming / Datafeeds / Tools
    Replies: 3
    Last Post: December 13th, 2005, 01:04 PM
  4. Need help with a PHP/MySql Jump Script
    By dak142 in forum Programming / Datafeeds / Tools
    Replies: 11
    Last Post: April 13th, 2004, 07:29 PM

Posting Permissions

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