cyber_alchemist Posted November 6, 2013 Share Posted November 6, 2013 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('[email protected]'); $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 https://forums.phpfreaks.com/topic/283639-help-with-the-transact-file/ Share on other sites More sharing options...
r3wt Posted November 6, 2013 Share Posted November 6, 2013 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.';' Link to comment https://forums.phpfreaks.com/topic/283639-help-with-the-transact-file/#findComment-1457148 Share on other sites More sharing options...
cyber_alchemist Posted November 6, 2013 Author Share Posted November 6, 2013 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.. Link to comment https://forums.phpfreaks.com/topic/283639-help-with-the-transact-file/#findComment-1457152 Share on other sites More sharing options...
r3wt Posted November 6, 2013 Share Posted November 6, 2013 well obviously i pointed out the fact you had a syntax error (missing ' ) surely you can fix a syntax error on your own? Link to comment https://forums.phpfreaks.com/topic/283639-help-with-the-transact-file/#findComment-1457155 Share on other sites More sharing options...
cyber_alchemist Posted November 6, 2013 Author Share Posted November 6, 2013 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 Link to comment https://forums.phpfreaks.com/topic/283639-help-with-the-transact-file/#findComment-1457157 Share on other sites More sharing options...
mac_gyver Posted November 6, 2013 Share Posted November 6, 2013 @r3wt, the OP's query did not contain a sql syntax error. however, the code change you posted did introduce a php syntax error. please, don't post code changes unless you know they are correct. Link to comment https://forums.phpfreaks.com/topic/283639-help-with-the-transact-file/#findComment-1457199 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.