Jump to content

problems with function that is tracking a record when updated


apophis

Recommended Posts

I have 2 tables

 

$tblprefix.basenji and the $tblprefix.tracking

The $tblprefix.basenji contains records and all records have unique basenji_id

the $tblprefix.tracking is only having basenji_id e-mail and action (enum) = sub

 

From the moment a person press "tracking" of a record, it happens and $tblprefix.tracking register the request in its tabel. basenji_id insert the id of that record from the table $tblprefix.basenji and the email of the person that is tracking that record.

As function i am using:

    // function: track_person 
    // send an email to everybody tracking an individual 
    function track_person($basenji) { 
        global $trackemail; 
        global $tblprefix; 
        global $err_person; 
        global $eTrackSubject; 
        global $eTrackBodyTop; 
        global $eTrackBodyBottom; 
        global $absurl; 

        $tquery = "SELECT ".$tblprefix."basenji.basenji_id, name, email FROM ".$tblprefix."basenji, ".$tblprefix."tracking WHERE ".$tblprefix."basenji.basenji_id = ".$tblprefix."tracking.basenji_id AND ".$tblprefix."basenji.basenji_id = ".quote_smart($basenji)." AND `key` = '' AND expires = '0000-00-00 00:00:00'"; 
        $tresult = mysql_query($tquery) or die($err_person); 
        while ($trow = mysql_fetch_array($tresult)) { 
            $headers = "Content-type: text/plain; charset=iso-8859-1\r\n"; 
            $headers .= "From: <".$trackemail.">\r\n"; 
            $headers .= "X-Mailer: PHP/" . phpversion(); 
            $subject = str_replace("$1", $trow["name"], $eTrackSubject); 
            $body = str_replace("$1", $trow["name"], $eTrackBodyTop); 
            $body = str_replace("$2", $absurl, $body); 
            $body .= $absurl."basenji.php?basenji=".$trow["basenji_id"]."\n\n"; 
            $body .= $eTrackBodyBottom; 
            $body .= $absurl."track.php?basenji=".$trow["basenji_id"]."&action=unsub&email=".$trow["email"]."&name=".urlencode($trow["name"])."\n"; 

            mail($trow["email"], $subject, $body, $headers); 
        } 
        mysql_free_result($tresult); 
    }    // eod of track_person() 

 

below the query of the update form i put

 

   if ($tracking) 
    track_person($_REQUEST["basenji"]); 

 

What is wrong?

$tracking = true

I tried a lot and nothing works.

??? ??? ???

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.