SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Location
    US
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    affiliate script

    I installed php-affiliate and everything seems ok except when testing the signup form [http://www.i-netsolutions.net/affiliates/user/signup.php] I received the following error:

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/i-netsol/public_html/affiliates/user/signup2.php on line 6
    Database INSERT Error (line 31)

    It's will not go to signup2.php on submit, here's signup2.php code:

    <?PHP


    include "../config.php";


    {
    mysql_connect($server, $db_user, $db_pass) or die ("Database CONNECT Error (line 8)");



    $chk_email = mysql_db_query($database, "select refid from affiliates where refid='$ausername'");

    $chkd_email = mysql_num_rows($chk_email);

    if ($chkd_email != "") {

    include "signup3.php";

    } else {

    $aemailbody = "Dear ".$afirstname.",\n\nThank you for signing up for our affiliate program.\nYour account details are below:\n\n"
    ."Username: ".$ausername."\nPassword: ".$apassword."\n\n"
    ."You can log into your account and view your 'real-time' statistics by going to:\n"
    ."http://".$domain."/user/index.php\n\n"
    ."Thank you once again, and we wish you great success with your profit making!\n\n\n"
    ."Affiliate Manager\n"
    ."".$emailinfo."\n\n\n\n";

    {
    mysql_connect($server, $db_user, $db_pass) or die ("Database CONNECT Error (line 29)");

    mysql_db_query($database, "INSERT INTO affiliates VALUES ('$ausername', '$apassword', '$acompany', '$atitle', '$afirstname', '$alastname', '$awebsite', '$aemail', '$apayable', '$astreet', '$atown', '$acounty', '$apostcode', '$acountry', '$aphone', '$afax', '$adate')") or die("Database INSERT Error (line 31)");
    }


    include "thankyou.php";

    mail($aemail, "Welcome New Affiliate!", $aemailbody, "From:".$emailinfo."\nReply-To:".$emailinfo."\n");




    }

    }
    ?>

    I'm using Apache 1.3.27, PHP 4.3.1, MySQL 3.23.56. Any suggestions?

    Thanks in advance.
    Affordable & Reliable Web Hosting
    http:www.i-netsolutions.net
    Web Hosting|Resellers|Affiliates|Dedicated Server Solutions
    sales@i-netsolutions.net
    AIM: INS2375

  2. #2
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    remove $database, from the queries
    Mike
    It's not who I am underneath, but what I do that defines me.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Location
    US
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by naramation
    remove $database, from the queries [img]images/smilies/smile.gif[/img]
    I did that and still received the error message:

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/i-netsol/public_html/affiliates/user/signup2.php on line 6
    Database INSERT Error (line 31)

    Example of the code:
    {
    mysql_connect($server, $db_user, $db_pass) or die ("Database CONNECT Error (line 8)");

    $chk_email = mysql_db_query($database, "select refid from affiliates where refid='$ausername'");

    Changed to:
    {
    mysql_connect($server, $db_user, $db_pass) or die ("Database CONNECT Error (line 8)");

    $chk_email = mysql_db_query("select refid from affiliates where refid='$ausername'");

    I repeated this for other queries wit $database. Any other suggestions.
    Affordable & Reliable Web Hosting
    http:www.i-netsolutions.net
    Web Hosting|Resellers|Affiliates|Dedicated Server Solutions
    sales@i-netsolutions.net
    AIM: INS2375


Bookmarks

Posting Permissions

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