Results 1 to 17 of 17
  1. #1
    Newbie Affiliate Ian's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,540
    Can a real progarmmer help me put these 2 functions into one? Much appreciated!

    if ($email){

    if (!($result = mysql_db_query($DB, "update tablename set source=nov2703 where email='$email'"))) {

    header("Location:http://$HTTP_HOST/error.php?error=103");//my error trapping
    exit();
    }
    echo "";
    }
    else{
    echo "";
    }

    AND

    if ($email){

    if (!($result = mysql_db_query($DB, "update tablename set count=count+1 where email='$email'"))) {

    header("Location:http://$HTTP_HOST/error.php?error=103");//my error trapping
    exit();
    }
    echo "";
    }
    else{
    echo "";
    }

    Ian Lee, M.Sc.

    Internet Marketing Strategist / Affiliate Manager
    EYI, Inc.
    ilee_NO_SPAM@eyi.us
    http://www.eyiproducts.com/affiliate.html
    604-596-9766

    Personal Sites: ADS-Links.com | HealthCastle.com

  2. #2
    ABW Ambassador cditty's Avatar
    Join Date
    January 18th, 2005
    Location
    Memphis TN
    Posts
    1,434
    I don't know if I understand this correctly, but is this what you want?

    if ($email){
    if (!($result = mysql_db_query($DB, "update tablename set source=nov2703 where email='$email'"))) {
    header("Location:http://$HTTP_HOST/error.php?error=103");//my error trapping
    exit();
    }
    if = mysql_db_query($DB, "update tablename set count=count+1 where email='$email'"))) {

    header("Location:http://$HTTP_HOST/error.php?error=103");//my error trapping
    exit();
    }
    echo "";
    }
    else{
    echo "";
    }

    If this is not what you are talking about, can you be a little more specific?

    Chris

    ----------------------------
    <FONT SIZE=1>ezDatafeed.com - Merchants - Give your affiliates your datafeed outside the networks, without cost to the affiliate. Check out ezDatafeed.com for more information.
    Scriptsforyoursite.com - Featuring datafeed import scripts for Backcountry Store, Coldwater Creek, Mondera.com and many more.....</font>

  3. #3
    Newbie Affiliate Ian's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,540
    Just tried your workaround, error parsing this line:

    ***********
    if = mysql_db_query($DB, "update tablename set count=count+1 where email='$email'"))) {
    ***********

    Sorry to be so vauge, my apologies. I am not much of a coder. Let me try again.

    I want to update 2 columns in my table. Basically, if $Email exists then go to the row where you find Email=$Email. Then in this row:

    1. Update source=nov23
    2. Update count=original count + 1

    Hope this makes more sense?

    Ian Lee, M.Sc.

    Internet Marketing Strategist / Affiliate Manager
    EYI, Inc.
    ilee_NO_SPAM@eyi.us
    http://www.eyiproducts.com/affiliate.html
    604-596-9766

    Personal Sites: ADS-Links.com | HealthCastle.com

  4. #4
    ABW Ambassador cditty's Avatar
    Join Date
    January 18th, 2005
    Location
    Memphis TN
    Posts
    1,434
    Sorry, problem when I did a cut and paste.

    <pre class="ip-ubbcode-code-pre">
    if ($email){
    mysql_db_query($DB, "update tablename set source=nov2703 where email='$email'") or die(header("Location:http://$HTTP_HOST/error.php?error=103"); //my error trapping
    mysql_db_query($DB, "update tablename set count=count+1 where email='$email'") or die(header("Location:http://$HTTP_HOST/error.php?error=103"); //my error trapping
    }
    echo "";
    }
    else{
    echo "";
    }
    </pre>

    There is no need for the $result since you are doing an update. Also, I moved the header location into the die statement. Should work.

    Chris

    ----------------------------
    &lt;FONT SIZE=1&gt;ezDatafeed.com - Merchants - Give your affiliates your datafeed outside the networks, without cost to the affiliate. Check out ezDatafeed.com for more information.
    Scriptsforyoursite.com - Featuring datafeed import scripts for Backcountry Store, Coldwater Creek, Mondera.com and many more.....&lt;/font&gt;

  5. #5
    Newbie Affiliate Ian's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,540
    OK I suck, here is the full code, still can't get it to work. Can't even get to the "Do Nothing" stage. Can't parse Line 14.Line 14 starts with "mysql_db_query($DB, "update..."

    &lt;?php
    $DB_SERVER = "mysqlserver";
    $DB_LOGIN = "id";
    $DB_PASSWORD = "pw";
    $DB = "database";
    $HTTP_HOST = "www.domain.com/";

    if (!($link = mysql_connect ($DB_SERVER, $DB_LOGIN, $DB_PASSWORD))) {
    header("Location:http://$HTTP_HOST/error.php?error=103");
    exit();
    }

    if ($Email){
    mysql_db_query($DB, "update tablename set Clickback=nov2703 where Email='$Email'") or die(header("Location:http://$HTTP_HOST/error.php?error=103"); //my error trapping
    mysql_db_query($DB, "update tablename set Clickcount=Clickcount+1 where Email='$Email'") or die(header("Location:http://$HTTP_HOST/error.php?error=103"); //my error trapping
    }
    echo "Set";
    }
    else{
    echo "Do Nothing";
    }


    ?&gt;

    Ian Lee, M.Sc.

    Internet Marketing Strategist / Affiliate Manager
    EYI, Inc.
    ilee_NO_SPAM@eyi.us
    http://www.eyiproducts.com/affiliate.html
    604-596-9766

    Personal Sites: ADS-Links.com | HealthCastle.com

  6. #6
    ABW Ambassador cditty's Avatar
    Join Date
    January 18th, 2005
    Location
    Memphis TN
    Posts
    1,434
    Try this. I just use mysql_query. Hasn't let me down yet.

    Chris

    <pre class="ip-ubbcode-code-pre">
    &lt;?
    $DB_SERVER = "mysqlserver";
    $DB_LOGIN = "id";
    $DB_PASSWORD = "pw";
    $DB_NAME = "database";
    $HTTP_HOST = "www.domain.com/";

    $db = mysql_connect("$HTTP_HOST", "$DB_LOGIN", "$DB_PASSWORD") or die(header("Location:http://$HTTP_HOST/error.php?error=103"); //my error trapping
    mysql_select_db("$DB_NAME",$db); //Main DB Query tag

    if ($Email){
    mysql_query("update tablename set Clickback=nov2703 where Email='$Email'") or die(header("Location:http://$HTTP_HOST/error.php?error=103"); //my error trapping
    mysql_query("update tablename set Clickcount=Clickcount+1 where Email='$Email'") or die(header("Location:http://$HTTP_HOST/error.php?error=103"); //my error trapping
    }
    echo "Set";
    }
    else{
    echo "Do Nothing";
    }
    ?&gt;
    </pre>

    ----------------------------
    &lt;FONT SIZE=1&gt;ezDatafeed.com - Merchants - Give your affiliates your datafeed outside the networks, without cost to the affiliate. Check out ezDatafeed.com for more information.
    Scriptsforyoursite.com - Featuring datafeed import scripts for Backcountry Store, Coldwater Creek, Mondera.com and many more.....&lt;/font&gt;

  7. #7
    Newbie Affiliate Ian's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,540
    Stil not parsing line 8:

    $db = mysql_connect("$HTTP_HOST", "$DB_LOGIN", "$DB_PASSWORD") or die(header("Location:http://$HTTP_HOST/error.php?error=103"); //my error trapping

    I really suck!

    Ian Lee, M.Sc.

    Internet Marketing Strategist / Affiliate Manager
    EYI, Inc.
    ilee_NO_SPAM@eyi.us
    http://www.eyiproducts.com/affiliate.html
    604-596-9766

    Personal Sites: ADS-Links.com | HealthCastle.com

  8. #8
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    Your missing a closing ')' on die().

    $db = mysql_connect($HTTP_HOST, $DB_LOGIN, $DB_PASSWORD)
    or die(header("Location:http://$HTTP_HOST/error.php?error=103")); //my error trapping

    ------------------------------
    "Everybody gets so much information all day long that they lose their common sense." - Gertrude Stein, American author (1874-1946).

  9. #9
    Newbie Affiliate Ian's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,540
    Ok, almost there. Added three ')'s in the die statements.

    Now not parsing line 16. Line 16 is in BOLD.

    &lt;?php
    $DB_SERVER = "mysqlserver";
    $DB_LOGIN = "id";
    $DB_PASSWORD = "pw";
    $DB_NAME = "database";
    $HTTP_HOST = "www.domain.com/";

    $db = mysql_connect($HTTP_HOST, $DB_LOGIN, $DB_PASSWORD) or die(header("Location:http://$HTTP_HOST/error.php?error=103")); //my error trapping
    mysql_select_db("$DB_NAME",$db); //Main DB Query tag

    if ($Email){
    mysql_query("update tablename set Clickback=nov2703 where Email='$Email'") or die(header("Location:http://$HTTP_HOST/error.php?error=103")); //my error trapping
    mysql_query("update tablename set Clickcount=Clickcount+1 where Email='$Email'") or die(header("Location:http://$HTTP_HOST/error.php?error=103")); //my error trapping
    }
    echo "Set";
    }

    else{
    echo "Do Nothing";
    }
    ?&gt;

    Ian Lee, M.Sc.

    Internet Marketing Strategist / Affiliate Manager
    EYI, Inc.
    ilee_NO_SPAM@eyi.us
    http://www.eyiproducts.com/affiliate.html
    604-596-9766

    Personal Sites: ADS-Links.com | HealthCastle.com

  10. #10
    ABW Ambassador FFoc's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,015
    remove it - one too many }s

    You should use a program that's intended for programming to edit it - it will show you where brackets and parens are paired..

    A decent free PHP programming editor or two --
    Windoze:
    http://hapedit.free.fr/
    http://www.pleskina.com/dphped

    *nix (windoze and mac versions available but not really recommended):
    http://www.xemacs.org/
    http://www.jedsoft.org/jed/

    --
    "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

  11. #11
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    Move that echo "set"; up too.

    ------------------------------
    "Everybody gets so much information all day long that they lose their common sense." - Gertrude Stein, American author (1874-1946).

  12. #12
    Newbie Affiliate Ian's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,540
    ok, tried both suggestions, still can't parse some lines. Would it be too much to ask that someone post the entire script so I can copy and paste. I will change my login info and tablename of course and I can test it that way.

    Sorry to be such a pain but I am not much of a coder.

    Thanks!

    Ian Lee, M.Sc.

    Internet Marketing Strategist / Affiliate Manager
    EYI, Inc.
    ilee_NO_SPAM@eyi.us
    http://www.eyiproducts.com/affiliate.html
    604-596-9766

    Personal Sites: ADS-Links.com | HealthCastle.com

  13. #13
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    &lt;?php
    $DB_SERVER = "mysqlserver";
    $DB_LOGIN = "id";
    $DB_PASSWORD = "pw";
    $DB_NAME = "database";
    $HTTP_HOST = "www.domain.com/";

    $db = mysql_connect($HTTP_HOST, $DB_LOGIN, $DB_PASSWORD) or die(header("Location:http://$HTTP_HOST/error.php?error=103"));
    mysql_select_db("$DB_NAME",$db);

    if ($Email){
    mysql_query("update tablename set Clickback=nov2703 where Email='$Email'") or die(header("Location:http://$HTTP_HOST/error.php?error=103"));
    mysql_query("update tablename set Clickcount=Clickcount+1 where Email='$Email'") or die(header("Location:http://$HTTP_HOST/error.php?error=103"));
    echo "Set";
    } else {
    echo "Do Nothing";
    }
    ?&gt;

    Umm..How this?

    [edit - I just notice you started out with $email and now it's $Email you might want to check that.]

    ------------------------------
    "People think they have taken quite an extraordinarily bold step forward when they have rid themselves of belief in hereditary monarchy and swear by the democratic republic. In reality, however, the state is nothing but a machine for the oppression of one class by another, and indeed in the democratic republic no less than in the monarchy." - Friedrich Engels

    [This message was edited by Buddha on November 28, 2003 at 03:46 PM.]

  14. #14
    Newbie Affiliate Ian's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,540
    Hey a BIG THANKS to everyone for helping out. Like I said, I love this place.

    Warning: Unknown MySQL Server Host 'www.domain.com/' (0) in /usr/local/apache/htdocs/www.domain.com/php/clicktrack.php on line 8

    Warning: MySQL Connection Failed: Unknown MySQL Server Host 'www.domain.com/' (0) in /usr/local/apache/htdocs/www.domain.com/php/clicktrack.php on line 8

    Warning: Cannot add header information - headers already sent by (output started at /usr/local/apache/htdocs/www.domain.com/php/clicktrack.php:8) in /usr/local/apache/htdocs/www.domain.com/php/clicktrack.php on line 8

    Since my web server is not on the same server as the MySQL server, I will need to get $HTTP_HOST from my hosting company.

    Thanks a million guys! Almost there!

    [This message was edited by Ian @ EYIProducts on November 28, 2003 at 07:03 PM.]

  15. #15
    ABW Ambassador cditty's Avatar
    Join Date
    January 18th, 2005
    Location
    Memphis TN
    Posts
    1,434
    Try taking the / off the domain name. If that doesn't work, try using the whole domain. ie...http://......

    Chris

    ----------------------------
    &lt;FONT SIZE=1&gt;ezDatafeed.com - Merchants - Give your affiliates your datafeed outside the networks, without cost to the affiliate. Check out ezDatafeed.com for more information.
    Scriptsforyoursite.com - Featuring datafeed import scripts for Backcountry Store, Coldwater Creek, Mondera.com and many more.....&lt;/font&gt;

  16. #16
    Newbie Affiliate Ian's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,540
    This is driving me nuts. It worked 1 time to the Do Nothing stage. THen tried it again and now nothing works, not even if I go back to the above post and try the codes there. Yikes......

    Ian Lee, M.Sc.

    Internet Marketing Strategist / Affiliate Manager
    EYI, Inc.
    ilee_NO_SPAM@eyi.us
    http://www.eyiproducts.com/affiliate.html
    604-596-9766

    Personal Sites: ADS-Links.com | HealthCastle.com

  17. #17
    Newbie Affiliate Ian's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,540
    ok wait, I got it to Do Nothing if I just use the IP of my ISP's MySQL server.

    But when I activet the url with $Email, then it goes to http://mysql.IP/error.php?error=103

    This is true if I add $Email, any email even if it's not in my table.

    ...

    Ian Lee, M.Sc.

    Internet Marketing Strategist / Affiliate Manager
    EYI, Inc.
    ilee_NO_SPAM@eyi.us
    http://www.eyiproducts.com/affiliate.html
    604-596-9766

    Personal Sites: ADS-Links.com | HealthCastle.com

  18. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Anyone Running ABEBOOKS?
    By Anne in forum Commission Junction - CJ
    Replies: 2
    Last Post: November 28th, 2005, 12:16 AM
  2. Spammers running!
    By wyvern in forum Spam
    Replies: 1
    Last Post: October 12th, 2005, 08:06 PM
  3. Running Away
    By TravelNow in forum Midnight Cafe'
    Replies: 0
    Last Post: October 9th, 2003, 03:12 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
  •