I am trying to get this form to send info to MySQL DB. The DB always issues an error. I have been trying to work out what the issue is and I do not seem to be able to find the problem. As I am a relative newbie that could have quite a lot to do with the problem. The code for the page to send info to DB is
<?php
error_reporting(E_ALL);
require_once('commoninclude.php');
session_start();
///session check
if(!(isset($_SESSION["admin"]) && $_SESSION["admin"] != ""))
{
header("Location:index.php");
}
$smarty = new Smarty();
if((isset($_SESSION['campaignid'])) && ($_SESSION['campaignid']!=""))
$newcampid=$_SESSION['campaignid'];
else
$newcampid="";
if( (isset($_SESSION['campid']) )&& ($_SESSION['campid']!=""))
{
$rowcamp= Show_Campaign($_SESSION['campid']);
}
if((isset($_REQUEST['view']))&& ($_REQUEST['view']!=""))
{
$excampid=$rowcamp[0];
$mesid=Update_Campaign_Messages($excampid);
$setingid=Update_Campaign_Settings($excampid);
$subscriberid=Update_Campaign_Subscribers($excampid);
$_SESSION['showcampid']="";
unset($_SESSION['showcampid']);
$_SESSION['editcamp']="no";
}
else if( (isset($_SESSION['edit']))&& ($_SESSION['edit']!=""))
{
$_SESSION['showcampid']="";
unset($_SESSION['showcampid']);
$_SESSION['editcampaignid']=$rowcamp[0];
$_SESSION['editcampaignname']=$rowcamp[1];
$_SESSION['editcamp']="yes";
}
if( (isset($_SESSION['editcampaignid'])) && ($_SESSION['editcampaignid']!=""))
{
$newcampid=$_SESSION['editcampaignid'];
$_SESSION['campaignid']=$newcampid;
}
else if( (isset($_SESSION['campaignid'])) && ($_SESSION['campaignid']!=""))
{
$newcampid=$_SESSION['campaignid'];
}
////coding for save settings
if(isset($_POST['txtsetfromname']))
{
$var=$_POST['auto_remove'];
$count_list=count($var);
if($count_list!=0)
{
$auto_remove=implode(",", $var);
}
else
{
$auto_remove="";
}
$setid= Update_Setting($_POST['txtsetfromname'],$_POST['txtsetfromemail'],$_POST['txtredirect'],
$_POST['txtredirect_unsubscribe'],$_POST['chkaddsublink'],$_POST['chkreporttoadmin'],
$_POST['settingid'],$_POST['txtadminmail'],$_POST['chkrssfeed'],$_POST['optintype'],
$_POST['dbl_opt_red_url'],$_POST['dbl_opt_subject'],$_POST['dbl_opt_matter'],
$_POST['chkstopmail'],$_POST['rss_subs'],$_POST['max_mail_limit'],
$_POST['next_camp_name'],$auto_remove,$_POST['require_pop'],$_POST['pop_server'],
$_POST['pop_emailid'],$_POST['pop_password'],$_POST['subs_thru_mail'],$_POST['subs_emailid'],
$_POST['subs_subject'],$_POST['unsubs_thru_mail'],$_POST['unsubs_emailid'],$_POST['unsubs_subject'],$_POST['msg_formate'],
$_POST['hd_block_ip_list'],$_POST['hd_block_semail_list'],$_POST['hd_block_domain_list'],
$_POST['hd_block_pemail_list'],
$_POST['field_last_name'],$_POST['blocked_redirect_url'],$_POST['call_api'],$_POST['product_number'],
$_POST['allow_rewards'],$_POST['number_signup'],$_POST['download_link'],
$_POST['referral_email_subject'],$_POST['referral_url_email'],
$_POST['reward_email_subject'],$_POST['reward_email'],
$_POST['allow_multiple_rewards'],$_POST['download_link_2'],$_POST['download_link_3'],
$_POST['allow_vistors_reward'],$_POST['multiple_vistors_reward'],
$_POST['numbers_of_visits'],$_POST['visit_reward1'],$_POST['visit_reward2'],
$_POST['visit_reward3'],$_POST['vistors_email_subject'],$_POST['vistors_reward_email']
);
else
$setid=Save_Settings($_POST['txtsetfromname'],$_POST['txtsetfromemail'],$_POST['txtredirect'],
$_POST['txtredirect_unsubscribe'],$_POST['chkaddsublink'],$_POST['chkreporttoadmin'],
$_POST['txtadminmail'],$_POST['chkrssfeed'],$_POST['optintype'],$_POST['dbl_opt_red_url'],
$_POST['dbl_opt_subject'],$_POST['dbl_opt_matter'],$_POST['chkstopmail'],
$_POST['rss_subs'],$_POST['max_mail_limit'], $_POST['next_camp_name'],$auto_remove,
$_POST['require_pop'],$_POST['pop_server'], $_POST['pop_emailid'],
$_POST['pop_password'],$_POST['subs_thru_mail'],$_POST['subs_emailid'],
$_POST['subs_subject'],$_POST['unsubs_thru_mail'],$_POST['unsubs_emailid'],$_POST['unsubs_subject'],$_POST['msg_formate'],
$_POST['hd_block_ip_list'],$_POST['hd_block_semail_list'],$_POST['hd_block_domain_list'],
$_POST['hd_block_pemail_list'],$_POST['field_last_name'],$_POST['blocked_redirect_url'],$_POST['call_api'],$_POST['product_number'],
$_POST['allow_rewards'],$_POST['number_signup'],$_POST['download_link'],
$_POST['referral_email_subject'],$_POST['referral_url_email'],
$_POST['reward_email_subject'],$_POST['reward_email'],
$_POST['allow_multiple_rewards'],$_POST['download_link_2'],$_POST['download_link_3'],
$_POST['allow_vistors_reward'],$_POST['multiple_vistors_reward'],
$_POST['numbers_of_visits'],$_POST['visit_reward1'],$_POST['visit_reward2'],
$_POST['visit_reward3'],$_POST['vistors_email_subject'],$_POST['vistors_reward_email']
); if(isset($_POST['settingid']) && ($_POST['settingid']!=""))
}
require_once('show.all.php');
if((isset($_REQUEST['savesetting'])) && ($_REQUEST['savesetting']!="") )
{
$smarty->assign("saved","true");
}
else
{
$smarty->assign("saved", "");
}
$newcampid=$_SESSION['campaignid'];
$camp_name=getNameByCamnpId($_SESSION['campid']);
$custom_fields=GetAllCustomFields($_SESSION['campid']);
$tracking_links=GetAllTracking_links($_SESSION['campid']);
$All_group=GetAllGroupName($_SESSION['campid']);
$campaign_list=Show_Selected_Campaign($_SESSION['campid']);
$smarty->assign("camp_name",$camp_name);
$smarty->assign("newcampid",$newcampid);
$smarty->assign("custom_fields",$custom_fields);
$smarty->assign("tracking_links",$tracking_links);
$smarty->assign("All_group",$All_group);
$smarty->assign("campaign_list",$campaign_list);
require_once('../include/menu.php');
$smarty->assign("url","campaign.php");
$smarty->assign("setting","settings.php?sec=savesetting");
$smarty->assign("message","message.php");
$smarty->assign("date","message.php");
$smarty->assign("subscriber","subscribers.php");
$smarty->display("settings.main.tpl.html");
// $RedirectTo = "showcamp.php?campid=".$newcampid;
// if (isset($_SERVER['QUERY_STRING']))
// {
// $RedirectTo .= (strpos($RedirectTo, '?')) ? "&" : "?";
// $RedirectTo .= $_SERVER['QUERY_STRING'];
//}
//sheader(sprintf("Location: %s", $RedirectTo));
require_once('richtext.php');
?>
The error code is as follows.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL, NULL, 0, NULL, NULL, NULL, NULL, ' at line 57 SQL query : Insert into rss_settings (
campid
,fromname
,fromurl
,redirecttourl
,redirect_url_after_unsubscribe
,setunsubscribelink
,reporttoadmin
,admin_email
,display_rss
,opt_in_type
,dbl_opt_redirect
,dbl_opt_sub
,dbl_opt_body
,stop_mail
,rss_subs
,max_mail_limit
,next_camp_name
,auto_remove
,require_pop
,pop_server
,pop_emailid
,pop_password
,subs_thru_mail
,subs_emailid
,subs_subject
,unsubs_thru_mail
,unsubs_emailid
,unsubs_subject
,msg_formate
,block_ip_list
,block_semail_list
,block_domain_list
,block_pemail_list
,field_last_name
,blocked_redirect_url
,call_api
,product_number
,allow_rewards
,number_signup
,download_link
,referral_email_subject
,referral_url_email
,reward_email_subject
,reward_email
,allow_vistors_reward
,multiple_vistors_reward
,numbers_of_visits
,visit_reward1
,visit_reward2
,visit_reward3
,vistors_email_subject
,vistors_reward_email
) VALUES(1, '360 Tee Times', '360teetimes@360teetimes.com', 'https://360teetimes.com/emails/thanks.php', 'https://360teetimes.com/emails/unsubscribe.php', NULL, NULL, 'facebookleads@360teetimes.com', NULL, 'Double', 'https://360teetimes.com/lead_page/index.php', 'Your Download is Ready', '#Name# Please download your book from the link below. #VerifyLink# Regards Mark A. Lockwood', NULL, NULL, 0, '1st Sale', NULL, 'N', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'text', NULL, NULL, NULL, NULL, 'on', NULL, NULL, NULL, 'No', 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL )
I am quite new to this and still learning so any pointers would be welcomed.
You're missing a comma between the 8th and 9th column from the end.
\/
NULL NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL )
/\