php - 需要帮助查找编码错误

标签 php mysql blind

这很可能只是我愚蠢的事情,但是我找不到我的代码似乎出问题的地方。我正在尝试为内部编辑页面准备一个SQL UPDATE命令(是的,我知道我不是在当前版本的PHP中编码-工作需要快速修复及其内部系统-请不要判断我!)数据库,无论我做什么,在告诉我我有多余的东西的时候,我总是遇到错误。在我的陈述中。但是,我要发布的UPDATE命令与我为其他地方几乎相同的数据库部分准备的另一个命令几乎完全相同(除非有几个字段),并且效果很好!我觉得我只是在某个地方缺少标点符号,但是我一直盯着它看了几个小时,所以我希望别人能看到。为了防万一,我实际上将发布整个代码块,而不只是发布UPDATE语句。

<?php
require("header.php");
$error_feat_id = "";
$valid_feature = "";
$error_feat_id = "";
$refferal_feat_id = $_GET['feat_id'];
if(isset($refferal_feat_id) == TRUE) {
    if(is_numeric($refferal_feat_id) == FALSE) {
        $error_feat_id = 1;
    }
    if($error_feat_id == 1) {
        header("Location: ".$config_basedir);
    }
    else {
        $valid_feature = $refferal_feat_id;
    }
}
else {
    $valid_feature = 0;
}

if($_POST['submit']) {
    $datereceived = $_POST['calendaryear']."-".$_POST['calendarmonth']."-".$_POST['calendarday'];
    $director1dob = $_POST['director1year']."-".$_POST['director1month']."-".$_POST['director1day'];
    $director2dob = $_POST['director2year']."-".$_POST['director2month']."-".$_POST['director2day'];
    $update_feature_sql = "UPDATE features SET Title = '".mysql_real_escape_string($_POST['title'])."', 
    DateReceived = STR_TO_DATE(".$datereceived.", '%Y-%m-%d'), 
    Synopsis = '".mysql_real_escape_string($_POST['synopsis'])."', 
    LogLine = '".mysql_real_escape_string($_POST['logline']."', 
    StrandID = ".$_POST['programstrand'].", 
    CompCatID = ".$_POST['compcat'].", 
    PremiereID = ".$_POST['premierestatus'].", 
    FirstFeatureID = ".$_POST['firstfeature'].", 
    OriginID = ".$_POST['origin'].", 
    RoughtCutID = ".$_POST['roughcut'].", 
    ScreenerID = ".$_POST['screener'].", 
    Director1 = '".mysql_real_escape_string($_POST['director1'])."', 
    Director1Bio = '".mysql_real_escape_string($_POST['director1bio'])."', 
    Director1Nationality = '".mysql_real_escape_string($_POST['director1nation'])."', 
    Director1DOB = STR_TO_DATE(".$director1dob.", '%Y-%m-%d'), 
    Director2 = '".mysql_real_escape_string($_POST['director2'])."', 
    Director2Bio = '".mysql_real_escape_string($_POST['director2bio'])."', 
    Director2Nationality = '".mysql_real_escape_string($_POST['director2nation'])."', 
    Director2DOB = STR_TO_DATE(".$director2dob.", '%Y-%m-%d'), 
    Country1 = '".mysql_real_escape_string($_POST['country1'])."', 
    Country2 = '".mysql_real_escape_string($_POST['country2'])."', 
    Country3 = '".mysql_real_escape_string($_POST['country3'])."', 
    Country4 = '".mysql_real_escape_string($_POST['country4'])."', 
    Country5 = '".mysql_real_escape_string($_POST['country5'])."', 
    Country6 = '".mysql_real_escape_string($_POST['country6'])."', 
    Country7 = '".mysql_real_escape_string($_POST['country7'])."', 
    Country8 = '".mysql_real_escape_string($_POST['country8'])."', 
    Country9 = '".mysql_real_escape_string($_POST['country9'])."', 
    Country10 = '".mysql_real_escape_string($_POST['country10'])."', 
    Cast1 = '".mysql_real_escape_string($_POST['cast1'])."', 
    Cast2 = '".mysql_real_escape_string($_POST['cast2'])."', 
    Cast3 = '".mysql_real_escape_string($_POST['cast3'])."', 
    Cast4 = '".mysql_real_escape_string($_POST['cast4'])."', 
    AdditionalComments = '".mysql_real_escape_string($_POST['additionalcomments'])."', 
    DurationHours = '".mysql_real_escape_string($_POST['durationhours'])."', 
    DurationMins = '".mysql_real_escape_string($_POST['durationmins'])."', 
    ScreeningFormat1 = ".$_POST['screeningformat1'].", 
    ScreeningFormat2 = ".$_POST['screeningformat2'].", 
    ScreeningFormat3 = ".$_POST['screeningformat3'].", 
    ScreeningFormat4 = ".$_POST['screeningformat4'].", 
    ScreeningFormat5 = ".$_POST['screeningformat5'].", 
    DCPEID = ".$_POST['dcpe'].", 
    DCPCPL = '".mysql_real_escape_string($_POST['dcpcpl'])."', 
    SubTypeID = ".$_POST['subtype'].", 
    AspectID = ".$_POST['aspect'].", 
    LanguageID = ".$_POST['language'].", 
    SubtitlesID = ".$_POST['subtitles'].", 
    AudioID = ".$_POST['audio'].", 
    PubRecID = ".$_POST['pubrec'].", 
    TypeOfMaterials = '".mysql_real_escape_string($_POST['typeofmaterials'])."', 
    ContactName = '".mysql_real_escape_string($_POST['contactname'])."', 
    ContactEmail = '".mysql_real_escape_string($_POST['contactemail'])."', 
    ContactPhone1 = '".mysql_real_escape_string($_POST['contactphone1'])."', 
    ContactPhone2 = '".mysql_real_escape_string($_POST['contactphone2'])."', 
    ContactAddress = '".mysql_real_escape_string($_POST['contactaddress'])."', 
    HomeAddressID = ".$_POST['homeaddress'].", 
    ContactWebsite = '".mysql_real_escape_string($_POST['contactwebsite'])."', 
    SAERecID = ".$_POST['saerec'].", 
    SAERetID = ".$_POST['saeret'].", 
    FeeStatusID = ".$_POST['feestatus'].", 
    EntryFeeID = ".$_POST['entryfee'].", 
    ProdYearID = '".mysql_real_escape_string($_POST['prodyear'])."', 
    ProdCo1 = '".mysql_real_escape_string($_POST['prodco1'])."', 
    ProdWebsite1 = '".mysql_real_escape_string($_POST['prodwebsite1'])."', 
    ProdCo1Nation = '".mysql_real_escape_string($_POST['prodco1nation'])."', 
    ProdCo2 = '".mysql_real_escape_string($_POST['prodco2'])."', 
    ProdWebsite2 = '".mysql_real_escape_string($_POST['prodwebsite2'])."', 
    ProdCo2Nation = '".mysql_real_escape_string($_POST['prodco2nation'])."', 
    Producer1 = '".mysql_real_escape_string($_POST['producer1'])."', 
    Producer1Nation = '".mysql_real_escape_string($_POST['producer1nation'])."', 
    Producer2 = '".mysql_real_escape_string($_POST['producer2'])."', 
    Producer2Nation = '".mysql_real_escape_string($_POST['producer2nation'])."', 
    Producer3 = '".mysql_real_escape_string($_POST['producer3'])."', 
    Producer3Nation = '".mysql_real_escape_string($_POST['producer3nation'])."', 
    Producer4 = '".mysql_real_escape_string($_POST['producer4'])."', 
    Producer4Nation = '".mysql_real_escape_string($_POST['producer4nation'])."', 
    SalesAgent = '".mysql_real_escape_string($_POST['salesagent'])."', 
    Distributor = '".mysql_real_escape_string($_POST['distributor'])."', 
    TalentAttached = '".mysql_real_escape_string($_POST['talentattached'])."', 
    PreviouslyScreenedAt = '".mysql_real_escape_string($_POST['prevscreenat'])."', 
    ScreeningFeesID = ".$_POST['screeningfees'].", 
    ScreeningFeesAmt = '".mysql_real_escape_string($_POST['screeningfeesamt'])."', 
    KidsID = ".$_POST['kids'].", 


代码在此行显示错误

ConfirmID = ".$_POST['confirm']." WHERE ID = ".$refferral_feat_id.";"; 


mysql_query($update_feature_sql) or die(mysql_error());
header("Location: ".$config_basedir."feat_show.php?feat_id=".$refferal_feat_id);
}
else {
    $sql_get_feature = "SELECT * FROM features WHERE ID = ".$refferal_feat_id.";";
    $query_get_feature = mysql_query($sql_get_feature);
    $rows_get_feature = mysql_fetch_assoc($query_get_feature);
?>


我意识到自己可能已经忽略了某些事情,而且我可以做得更有效率,但是我是一个PHP新手,可以同时完成几件事,并且确实可以使此代码正常工作!在此先感谢您的任何帮助/建议!

最佳答案

第二个代码块中的第一行有5个双引号。您的字符串没有终止。

本文翻译自 https://stackoverflow.com/questions/17053602/

网站遵循 CC BY-SA 4.0 协议,转载或引用请注明出处。


相关文章:

android - 使用onClick时禁用onTouch

php - 以Active Record样式ORM实施急切加载的干净方法?

php - CakePHP多个HABTM关系

php - 垃圾邮件检测服务的最佳语言选择

php - 字段为空时,PHP不返回任何行

mysql - Mysql子查询

android - 盲人可访问的Android Air应用程序。使用Android的话语提示

php - 如何在数组数组上使用array_unique?

php - 计算两个日期之间的小时数

android - 为盲人的Android无障碍模式构建应用程序