Jump to content

Help with the Transact File


cyber_alchemist
Go to solution Solved by cyber_alchemist,

Recommended Posts

this is my code ...

  if (!empty($user_id) && !empty($ml_id)) {
        echo 'empty security pass ..' ;
        $query = 'UPDATE ml_subscriptions
            SET
                pending = 0 
            WHERE
                user_id = ' . $user_id . ' AND
                ml_id = ' . $ml_list;

        mysql_query($query, $db);

        $query = 'SELECT
                listname
            FROM
                ml_lists
            WHERE
                ml_id = ' . $ml_id;
        $result = mysql_query($query, $db);

        $row = mysql_fetch_assoc($result);
        $listname = $row['listname'];
        
        mysql_free_result($result);

        $query = 'SELECT 
                first_name, email
            FROM
                ml_users
            WHERE
                user_id = ' . $user_id;
        $result = mysql_query($query, $db);

        $row = mysql_fetch_assoc($result);
        $first_name = $row['first_name'];
        $email = $row['email'];
        mysql_free_result($result);

        $message = 'Hello ' . $first_name . ',' . "\n";
        $message .= 'Thank you for subscribing to the ' . $listname .  ' mailing list.  Welcome!' . "\n\n";
        $message .= 'If you did not subscribe, please accept our ' .
            'apologies.  You can remove' . "\n";
        $message .= 'this subscription immediately by visiting the ' .
            'following URL:' . "\n";
        $message .= 'http://www.massmailer.pixub.com.com/ml_remove.php?user_id=' .
            $user_id . '&ml_id=' . $ml_id;

        $mail = new SimpleMail();
        $mail->setToAddress($email);
        $mail->setFromAddress('massmailer@pixub.com');
        $mail->setSubject('Mailing list subscription confirmed');
        $mail->setTextBody($message);
        $mail->send();
 
    header('Location: ml_thanks.php?user_id=' . $user_id . '&ml_id=' .
        $ml_id . '&type=s');
    } else {
        header('Location: ml_user.php');
    }

every this is working fine just that the query ...

$query = 'UPDATE ml_subscriptions
            SET
                pending = 0 
            WHERE
                user_id = ' . $user_id . ' AND
                ml_id = ' . $ml_list;

        mysql_query($query, $db);

doesn't seem to update my table , is my query is wrong ??? is my syntax is correct for the updating the table ??

Link to comment
Share on other sites

syntax error.

'UPDATE ml_subscriptions
SET
pending = 0
WHERE
user_id = '. $user_id .' AND
ml_id = '. $ml_list;

should be

'UPDATE ml_subscriptions
SET
pending = 0
WHERE
user_id = '.$user_id.' AND
ml_id = '.$ml_list.';'
Edited by r3wt
Link to comment
Share on other sites

but , 

;

comes after 

''

isn't it ???

 

like 

$query = '<your query >';

 it could be like :

'UPDATE ml_subscriptions
SET
pending = 0
WHERE
user_id = '.$user_id.' AND
ml_id = '.$ml_list. '';

isn't it ?

 

phpcodechecker.com returns this error 

 

PHP Syntax Check: Parse error: syntax error, unexpected T_VARIABLE in your code on line 102

 

$result = mysql_query($query, $db); 

 

after i do what you asked..

Edited by cyber_alchemist
Link to comment
Share on other sites

  • Solution

yes i can but it didn't solved the problem ???? i mean both things mean the same ?

 

whether i write 

'UPDATE ml_subscriptions
SET
pending = 0
WHERE
user_id = '. $user_id .' AND
ml_id = '. $ml_list;

or

'UPDATE ml_subscriptions
SET
pending = 0
WHERE
user_id = '.$user_id.' AND
ml_id = '.$ml_list. '';

but anyways i got why it wasn't working from the irc channel :)

Edited by cyber_alchemist
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.