Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
redirects
  • Posted: 16.06.2004, 03:26
     
    techbetas
    rank:
    Freshman Freshman
    registered:
     June 2004
    Status:
    offline
    last visit:
    29.07.04
    Posts:
    9
    I have installed a redirect script "goredirect" that changes outboud urls like

    www.amazon.com
    to
    www.techrebate.com/go.php?id=34

    It installed fine, but once I click on my newly made links in PostNuke, it has an error like this:

    Code

    Warning: mysql_free_result(): supplied argument is not a valid mysql result resource in /home/techreba/public_html/go.php on line 77

    Warning: mysql_close(): supplied argument is not a valid MySQL-link resource in /home/techreba/public_html/go.php on line 78


    So... naturally I went back into the script go.php, which looks like this:

    Code

    /********************************************
    data capture section - server variables
    *********************************************/

    $linkid=$_GET['id'];
    $visitorip= $_SERVER['REMOTE_ADDR'];
    $visitorurl= $_SERVER['HTTP_REFERER'];
    $visitorbrowser= $_SERVER['HTTP_USER_AGENT'];
    $visitorpage=$_SERVER['REQUEST_URI'];

    /********************************************
    upload the data into the database
    *********************************************/

    $insertquery="INSERT INTO stats (ip,url,browser,date,page,linkid,sitecode) VALUES ('$visitorip','$visitorurl','$visitorbrowser',NOW(),'$visitorpage',$linkid,'$sitecode')";
    // echo $insertquery;
    $result=mysql_query($insertquery) or die(mysql_error());

    /********************************************
    redirect the user
    *********************************************/

    $sqlredir="SELECT * FROM redirs WHERE id=$linkid";
    $rdresult=mysql_query($sqlredir) or die(mysql_error());
    $row=mysql_fetch_assoc($rdresult) or die(mysql_error());
    $rdurl="Location: ".$row['redirect'];
    header($rdurl);

    /********************************************
    shut down the SQL connection and flush
    *********************************************/

    mysql_free_result($rdresult);
    mysql_free_result($result);
    $goodbye=mysql_close($conn);


    The lines 77 and 78 are the last 2 lines of the code

    Code

    mysql_free_result($result);
    $goodbye=mysql_close($conn);


    Any body have any ideas? Thanks for your time
    Glen
  • Posted: 16.06.2004, 12:32
     
    St.Ego
    rank:
    Softmore Softmore
    registered:
     December 1969
    Status:
    offline
    last visit:
    01.06.06
    Posts:
    65
    I would say that those two mysql functions are not working because you are missing "a valid MySQL result resource"...

    Your connection is failing, check your logon/pass/dbname/etc.
  • Posted: 16.06.2004, 13:29
     
    techbetas
    rank:
    Freshman Freshman
    registered:
     June 2004
    Status:
    offline
    last visit:
    29.07.04
    Posts:
    9

    St.Ego

    I would say that those two mysql functions are not working because you are missing "a valid MySQL result resource"...

    Your connection is failing, check your logon/pass/dbname/etc.
    I already checked the connections and everything.... it's not that. I am a psuedo-noob with scripts, and I don't really know much. Thanks for the help Sgt. Ego. Any more suggestions would still be great :)

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula