php - 存储信息故障

标签 php mysql insert

我正在尝试获取此表单以将信息发送到 MySQL DB。 DB 总是发出错误。我一直在尝试找出问题所在,但似乎无法找到问题所在。因为我是一个相对新手,可能与这个问题有很大关系。页面向数据库发送信息的代码为

<?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');

?>

错误代码如下。

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, 'somewhere', 'somewhere@somewhere.com', 'https://somewhere.com/emails/thanks.php', 'https://somewhere.com/emails/unsubscribe.php', NULL, NULL, 'facebookleads@somewhere.com', NULL, 'Double', 'https://somewhere.com/lead_page/index.php', 'Your Download is Ready', '#Name# Please download your book from the link below. #VerifyLink# Regards somebody', 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 )

我对此很陌生,仍在学习,因此欢迎任何指点。

最佳答案

从末尾算起的第 8 列和第 9 列之间缺少一个逗号。

   \/                  
NULL NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL )
   /\

关于php - 存储信息故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53504713/

相关文章:

javascript - 页面加载时选中的复选框

php - 虚拟主机安全

php - 数组在 php 中未按预期工作

php - 社会-双向友谊关系

mysql - 通过比较两个表获得总和

php - 如果不存在不同的结果,则插入到表中

php - 如何转换此 codeigniter 查询以选择更新

php - 存储在数组中或使用多个数据库查询

mysql - mysql 语法错误 - 插入查询

java - JPA/hibernate : How to use INSERT JPQL?