簡體   English   中英

更新語句最后顯示空白

[英]Update statement showing a blank space in the end

當我將表單提交給Update函數時,頁面標題中會出現一個空白行,然后如果我打印更新語句不起作用,因為最后顯示的是空白,並且如果粘貼在文本編輯器上,如Toad ,看起來好像有連字符。 查看下面的圖片

將函數打印並粘貼到Toad后,出現連字符,如不可見

打印功能

      UPDATE style_schedule_image SET
                description = '1-Shoe Boxes - BULK'
            WHERE
                id = '116741';

這是我的代碼上的問題嗎? 我搜索了所有代碼,但找不到它。

網頁

        <?php
            session_start();
            if(!$_SESSION["id_user"]){
                die(header("location: ../login.php"));
            }

            include('../_functions/parameters.php');
            include('../_functions/database_open.php');
            include('../_functions/functions.php');
            include("../_functions/translator.php");
            include('../_class/class_final_inspection.php');

            $uploaddir = '../croquis/style_cfm_picture/';

            $class_final_inspection = new class_final_inspection();

            include('../_library/_email/class_send_email.php');
            $send_email = new class_send_email();

            if (isset($_POST))
            {
                if ($_POST['FUNCAO'] == "PICTURE")
                {

                    $style_schedule = $class_final_inspection->select_open_final_inspection(
                        $_POST['id_inspection']
                    );

                    $select_picture = $class_final_inspection->query_picture(
                        $_POST['id_inspection']
                    );

                }

                if ($_POST['FUNCAO'] == "INSERT_PICTURE")
                {

                    $select_picture_for_update = $class_final_inspection->query_files_final_picture_for_update(
                        $_POST['id_inspection']
                    );  

                    $linha_total_pic = mysql_fetch_object($select_picture_for_update);  

                    $reg_total_txt = explode("#;", $_POST['text_dados']);

                    for ($id = 1; $id <= $linha_total_pic->total; $id++) {

                    $linha_ln = explode("|", $reg_total_txt[$id]);                  

                    $itens = $class_final_inspection->update_pictures(
                        $linha_ln[0],
                        $linha_ln[1]
                        );  
                    }

                }

                if ($_POST['FUNCAO'] == "DELETE_PICTURE")
                {
                    $openddir = '../../dotcom/croquis/final_inspection_pictures/';

                    unlink($openddir.$_POST['id_image'].".jpg");

                    $message = $select_picture = $class_final_inspection->delete_picture(
                        $_POST['id_image']
                    );

                    $style_schedule = $class_final_inspection->select_open_final_inspection(
                        $_POST['id_inspection']
                    );

                    $select_picture = $class_final_inspection->query_files_final_picture(
                        $_POST['id_inspection']
                    );
                }

                if ($_POST['FUNCAO'] == "SEND_EMAIL")
            {   
                $agora_vai = ($send_email->send_final_inspection_report(
                    $_POST['id_inspection'],
                    $_POST['vl_contacts']
                ));

                if($agora_vai == 'Email sent successfully!'){
                $update_email_sent = $class_final_inspection->update_email_sent(
                        $_POST['id_inspection']
                );}
            }

        }

        ?>
        <html>
            <head>
                <title><?php print $translator_title['FINALINSP']; ?></title>
                <meta http-equiv="cache-control" content="no-cache" />
                <link rel="stylesheet" type="text/css" href="../_library/_css/menu.css" >
                <link rel="stylesheet" type="text/css" href="../_library/_css/system.css" >
                <script language="JavaScript" type="text/javascript" src="../_library/_js/default.js"></script>
                <script language="JavaScript" type="text/javascript" src="../_library/_js/final_inspection.js"></script>
                <meta content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=yes" name="viewport">
                <meta charset="UTF-8">
            </head>
            <body style="margin:0; background-color:#E4E4E4;">
                <table width="100%" cellpadding="1" cellspacing="1">
                    <tr class="menu_title title_color"><td align="center" width="50px" onclick="back_to_menu();" ><img src="../_img/_back.png" width="30"></td><td align="center"><?php print $translator_title['FINALINSP']; ?> - <?php print $translator_title['PICTURE']; ?></td></tr>
                    <?php
                    if($agora_vai){

                        print '<tr><td class="field_options" align="center" style="text-align:center; background-color:#AEB9C5; font-size:20px;" colspan="3"><b>'.$agora_vai.'</b></td></tr>';

                        if($agora_vai == 'Email sent successfully!'){ print '<tr><td class="field_options" align="center" style="text-align:center; background-color:#AEB9C5; font-size:20px;" colspan="3">
                    <img style="cursor:pointer;" src="../_img/email_sended.png" width="100" height="120"</td></tr>'; }

                    }
                    ?>
                </table>
                <?php if($style_schedule){

                    $linha_schedule = mysql_fetch_object($style_schedule);
                ?>
                <form method="post" name="FORM_INSERT_SCHEDULE_PICTURE" enctype="multipart/form-data">
                <input type="hidden" name="FUNCAO" value="INSERT_PICTURE">
                <textarea class="textstyle" name="text_dados" style="display:none;"></textarea>
                <input type="hidden" name="id_image" value="">
                <input type="hidden" name="id_inspection" value="<?php print $linha_schedule->id; ?>">
                <table cellpadding="2" cellspacing="2" width="100%">

                    <tr class="line_style_sub_title">
                        <td class="field_options" align="center" colspan="5" title="<?php print $orig_translator_title['SAVE']; ?>"><input type="submit" name="save" value="<?php print $translator_title['SAVE']; ?>" style="width:100px;" class="field_options" /></td>
                    </tr>
                    <?php
                    if($file)
                    {
                    if($message)

                    {
                    echo ' 
                    <div>
                            <table width="100%" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td align="center" style="width:200; background-color:green;">'.$orig_translator_title['PICTUREINSERTED'].'</td>
                                </tr>
                            </table>
                    </div> ';

                    }
                    }
                    ?>
                </table>
                </form>
                    <div id="frame_comments">       
                    <iframe id="hts" name="frame_hts" id="frame_hts" border="0" style="display:none;"></iframe>
                    <table cellpadding="2" cellspacing="2" width="100%">
                    <tr class="line_style_sub_title">
                        <td class="field_options" align="center" colspan="5" title="<?php print $orig_translator_title['SENDEMAIL']; ?>"><input type="submit" onclick="check_contacts_email();" name="save" value="<?php print $translator_title['SENDEMAIL']; ?>" style="width:200px;" class="field_options"/></td>
                    </tr>   
                    </table>

                    </div>
                    <form method="post" name="FORM_SHOW_COMMENTS" action="" style="display:none;" enctype="multipart/form-data">
                    <input type="hidden" name="FUNCAO" value="SEND_EMAIL">
                    <input type="hidden" name="id_inspection" value="<?php print $linha_schedule->id; ?>">
                    </form>
                <?php 

                    print '
                    <center>
                    <div align="center" style="height:50%; border:none; width:90%; text-align:center;">
                    <table width="100%" align="center">
                        ';

                    $td_count = 1;

                    $openddir = '../croquis/final_inspection_pictures/';

                    while($linha_images = mysql_fetch_object($select_picture))
                    {
                        $components_ln = explode("#|",$linha_schedule->defect_description);

                        print' <tr>';

                        if($linha_images->type_comments == 'pdf'){
                        $openflie = '';
                        $openflie = $openddir.'Final Inspection Report - '.$linha_images->id_shipment_instruction.'.pdf' ; } else {
                            $openflie = '';
                        $openflie = $openddir.$linha_images->id.'.jpg' ;
                        }

                        $icon = $openddir.$linha_images->id.'.'.($linha_images->type_comments == 'jpeg' ? 'jpg' : 'jpg');
                        $edit_image = '<a title="Edit this image" href="../_library/_image/editor.php?id='.$linha_images->id.'|EDT&style_edit='.$_POST['style_edit'].'&upper='.$_POST['upper'].'&color='.$_POST['color'].'&seq='.$_POST['seq'].'" target="image_editor"><img src="../_img/image_edit.png" width="24" height="24" style="background-color:#A6A6A6; border-radius: 0.2em;"></a><br>';


                        if($linha_images->type_comments == 'pdf'){
                            $icon = '../_img/icon_pdf.png';
                            $edit_image = '';
                        }

                        print '<td align="right">

                                    <div style="float:right; vertical-align:bottom;">
                                        '.($linha_images->type_comments != 'pdf' ? '<img title="Delete this image" src="../_img/bg_remove.png" width="35" height="35" onclick="deleteImage('.$linha_images->id.');" style="background-color:#A6A6A6; border-radius: 0.2em; border:2px solid #FFFFFF;"><br>' : '').'

                                        </div>
                                    <div  style="float:right; vertical-align:bottom;"><a href="'.$openflie.'" target="_black" title="Click to open!"><img height="140px" width="140px" src="'.$icon.'"><a/>

                                    '.($linha_images->type_comments != 'pdf' ? 
                                    '


                                    <input type="hidden" id="picture_id_'.$td_count.'" value="'.$linha_images->id.'">
                                    <input type="hidden" id="description_'.$td_count.'" value="'.$linha_images->description.'">
                                    <td align="left">
                                    '.$linha_images->description.' <br>
                                    <select id="prod_sample_pictures_'.$td_count.'" name="prod_sample" class="textstyle_mobile" style="width:150px;" required>
                                        <option value="">::Select::</option>
                                    <optgroup label="BULK PRODUCTION PICTURES">
                                        <option value="1-Shoe Boxes - BULK">                                    '.$translator_title['SHOEBOX'].'</option>                   
                                        <option value="2-Pictogram - BULK">                                     '.$translator_title['PICTOGRAM'].'</option>
                                        <option value="3-Production Pairs Front - BULK">                        '.$translator_title['PRODUCTIONFRONT'].'</option>
                                        <option value="4-Production Pairs Side - BULK">                         '.$translator_title['PRODUCTIONSIDE'].'</option>
                                        <option value="5-Production Pairs Back - BULK">                         '.$translator_title['PRODUCTIONBACK'].'</option>
                                        <option value="6-Production pair with CFM Front - BULK">                '.$translator_title['PRODUCTIONCMFFRONT'].'</option>
                                        <option value="7-Production pair with CFM Side - BULK">                 '.$translator_title['PRODUCTIONCMFSIDE'].'</option>
                                        <option value="8-Production pair with CFM Back - BULK">                 '.$translator_title['PRODUCTIONCMFBACK'].'</option>

                                    <optgroup label="DEFECTS">

                                            '.($components_ln[2] != null || $components_ln[3] != null || $components_ln[4] != null ?        '<option value="9-Vamp crooked - DEFECT">                           '.$translator_title['VAMPCROOKED'].'</option>' : '').'
                                            '.($components_ln[5] != null || $components_ln[6] != null || $components_ln[7] != null ?        '<option value="10- Vamp not in pair - DEFECT">                     '.$translator_title['VAMPNOTINPAIR'].'</option>' : '').'
                                        </select></td>  





                                    </form>' : '').'



                                    </div></td>

                                    </tr>';
                        $td_count++;


                    }

                    print'  
                    </tr>
                    </table>
                    </div>
                    </center>';

                    } 
                ?>

            </body> 
        </html>

    <?php
    session_start();
    if(!$_SESSION["id_user"]){
        die(header("location: ../login.php"));
    }

    class class_final_inspection 
    {

       function select_final_inspection_quantity($po)
       {

            $query="
                select
                    factory.name as factory_name,
                    brand.name as brand_name,
                    po_item.po, 
                    po_item.seq,
                    po_item.upper_po, 
                    po_item.color_po,
                    style.id as style_id,
                    style.style,
                    style.name, 
                    style.customer_style_1, 
                    style.customer_style_2,
                    (po_item.pairs-ifnull(shipment_instruction.pairs,0)) as pairs
                from
                    po
                    inner join factory on
                        po.id_factory = factory.id
                    inner join brand on
                        po.id_brand = brand.id  
                    inner join po_item on
                        po.po = po_item.po  
                    inner join style on
                        po_item.id_style = style.id
                    left join
                        (
                        select 
                            shipment_instruction_item.po,
                            shipment_instruction_item.seq,
                            sum(shipment_instruction_item.pairs) as pairs
                        from
                            shipment_instruction
                            inner join shipment_instruction_item on
                                shipment_instruction.id = shipment_instruction_item.id_shipment_instruction
                        where
                            shipment_instruction.final_inspection is not null
                            and shipment_instruction.status = 'A'
                      and shipment_instruction.po = '".$po."'
                        group by
                            shipment_instruction_item.po,
                            shipment_instruction_item.seq
                        ) as shipment_instruction on
                    shipment_instruction.po = po_item.po and
                        shipment_instruction.seq = po_item.seq
                where
                    po.po = '".$po."'
                    and (po_item.pairs-ifnull(shipment_instruction.pairs,0)) > 0
                group by
                    po_item.po,
                    po_item.seq
                order by
                    style.id,
                    po_item.po,
                    po_item.seq

            ";

            return ($rs = mysql_query($query)) ? $rs : 'ERROR: '.mysql_error();
        }

        function open_final_inspetion($id_final_inspection)
        {

            $query="
                SELECT
                    style.id,
                    style_combination.sku_number,
                    style.customer_style_1  as customer_style,
                    style_schedule.id as style_schedule_id,
                    style_schedule.id_final_inspection as id_final,
                    style_combination.id as id_combination,
                    brand.name as brand_name,
                    factory.id as factory_id,
                    factory.name as factory_name,
                    season.short as season_short,
                    style.style,
                    users.id as user_id,
                    CASE WHEN style.name != '' THEN
                        style.name
                    WHEN style.customer_style_1 != '' THEN
                        style.customer_style_1
                    WHEN style.customer_style_2 != '' THEN
                        style.customer_style_2
                    END as style_name,
                    style_combination.upper as material, 
                    style_combination.color,
                    DATE_FORMAT(now(),'%d/%b/%y') as conf_date,
                    stage_status.status as status_name,
                    style_schedule.status,
                    style_schedule.comments,
                    UPPER(users.name) as user_name,
                    style_schedule.stage,
                    style_schedule.form_information
                FROM
                    style
                    inner join style_schedule ON
                        style.id = style_schedule.id_style
                    inner join style_combination ON
                        style_schedule.id_style_combination = style_combination.id
                    inner join factory ON 
                        style.id_factory = factory.id
                    inner join season ON 
                        style.id_season = season.id
                    inner join brand ON 
                        style.id_brand = brand.id
                    inner join stage_status ON
                        style_schedule.status = stage_status.id
                    left join users ON
                        style_schedule.id_user = users.id
                WHERE
                    style_schedule.id_final_inspection = '".$id_final_inspection."'
                ORDER BY
                    factory.name;

            ";


            return ($rs = mysql_query($query)) ? $rs : 'ERROR: '.mysql_error();
        }

        function query_picture($id_final_inspection){

            $query = "
            select
                style_schedule_image.*
            from
                style_schedule_image
            where
                style_schedule_image.id_schedule in (select id from style_schedule where style_schedule.id_final_inspection = '".$id_final_inspection."')
            order by type_comments
            ;";

            return ($rs = mysql_query($query)) ? $rs : 'ERROR: '.mysql_error();

        }

        function insert_file($id_schedule,$id_daily_inspection){

            $query="
                INSERT INTO style_schedule_image 
                (
                    id_schedule,
                    id_shipment_instruction,
                    type_comments,
                    description
                )
                VALUES 
                (
                    '".$id_schedule."',
                    '".$id_daily_inspection."',
                    'pdf',
                    'Final Inspection Report'
                )
            ";

            return ($rs = mysql_query($query)) ? $rs : 'ERROR: '.mysql_error();

        }


        function query_files_final_picture($id_final_inspection){

            $query = "
                select style_schedule_image.*,shipment_instruction.defect_description  FROM style_schedule_image left join shipment_instruction on shipment_instruction.id = style_schedule_image.id_shipment_instruction where style_schedule_image.id_shipment_instruction = '".$id_final_inspection."' order by type_comments;";


            return ($rs = mysql_query($query)) ? $rs : 'ERROR: '.mysql_error();

        }

        function query_files_final_picture_for_update($id_final_inspection){

            $query = "
                select count(*) as total FROM style_schedule_image where style_schedule_image.id_shipment_instruction = '".$id_final_inspection."' and type_comments = 'jpeg';
            ";


            return ($rs = mysql_query($query)) ? $rs : 'ERROR: '.mysql_error();

        }

        function query_files_final_report($id_final_inspection){

            $query = "
            select
                style_schedule_image.*
            from
                style_schedule_image
            where
                style_schedule_image.id_shipment_instruction = '".$id_final_inspection."'
                and style_schedule_image.type_comments = 'pdf';
            ";


            return ($rs = mysql_query($query)) ? $rs : 'ERROR: '.mysql_error();

        }

        function schedule_insert_picture($id_schedule,$id_shipment_instruction,$extension,$file_name,$description){

            $query="
                INSERT INTO style_schedule_image 
                (
                    id_schedule,
                    id_shipment_instruction,
                    type_comments,
                    title_comments,
                    description

                )
                VALUES 
                (
                    '".$id_schedule."',
                    '".$id_shipment_instruction."',
                    '".$extension."',
                    '".$file_name."',
                    '".$description."'
                )
            ";

            return (mysql_query($query)) ? mysql_insert_id() : 'ERROR: '.mysql_error();
        }

        function insert_final_inspection_file($id_shipment_instruction,$format,$type,$description,$prod_sample){

            $query="
                INSERT INTO final_inspection_files
                (
                    id_shipment_instruction,
                    format,
                    type,
                    description,
                    id_picture_final
                )
                VALUES 
                (
                '".$id_shipment_instruction."',
                '".$format."',
                '".$type."',
                '".$description."',
                '".$prod_sample."');
            ";

            return (mysql_query($query)) ? mysql_insert_id() : 'ERROR: '.mysql_error();
        }

        function delete_picture($id_image){

            $query="
                DELETE FROM
                    style_schedule_image 
                WHERE
                    style_schedule_image.id = '".$id_image."'
                ;
            ";


            return (mysql_query($query)) ? 'Deleted successfully!' : 'ERROR: '.mysql_error();

        }

        function select_open_final_inspection($id_final_inspection){

            $query = "
            select
                inspection_total.id,
                inspection_total.po,
                po_item.color_po as po_color,
                po_item.id_combination,
                style_combination.sku_number,
                inspection_total.total_pairs,
                CASE WHEN po.r_xftry IS NOT NULL THEN DATE_FORMAT(po.r_xftry,'%d/%b/%y') ELSE DATE_FORMAT(po.xftry,'%d/%b/%y') end as real_x_fac,
                brand.name as brand_name,
                CASE WHEN IFNULL(classification_faults.sample_size_percent,0) > 0 THEN
                    round(classification_faults.sample_size_percent*inspection_total.total_pairs/100)
                ELSE
                    classification_faults.sample_size
                END quantity_to_inspect,
                classification_faults.how_many_CR, 
                classification_faults.how_many_MJ, 
                classification_faults.how_many_MN,
                sum(classification_faults.how_many_MJ+classification_faults.how_many_MN ) as total_faults,
                DATE_FORMAT(inspection_total.final_inspection,'%d/%b/%y') as final_inspection_date,
                inspection_total.quantity_inspected,
                inspection_total.cartons_inspected,
                inspection_total.comments,
                inspection_total.defect_description,
                inspection_total.status,
          inspection_total.total_mn as total_mn,
          inspection_total.total_mj as total_mj,
          inspection_total.total_cr as total_cr,
          inspection_total.total_faults_inspec as total_faults_inspec,
                CASE WHEN inspection_total.status = 'A' THEN 
                    'APPROVED'
                WHEN inspection_total.status = 'R' THEN
                    'REJECTED'
                ELSE
                    ''
                END status_name,
                inspection_total.user_name
            from  
                (
                select
                    shipment_instruction.id,
                    shipment_instruction.po,
                    shipment_instruction.quantity_inspected,
                    shipment_instruction.cartons_inspected,
                    shipment_instruction.comments,
                    shipment_instruction.defect_description,
                    shipment_instruction.status,
                    users.name as user_name,
                    shipment_instruction.final_inspection,
                    sum(shipment_instruction_item.pairs) as total_pairs,
                    shipment_instruction.total_mn,
                    shipment_instruction.total_mj,
                    shipment_instruction.total_cr,
                    shipment_instruction.total_faults_inspec
                from 
                    shipment_instruction
                    inner join shipment_instruction_item on
                        shipment_instruction.id = shipment_instruction_item.id_shipment_instruction  
                    left join users on 
                        shipment_instruction.id_user = users.id
                where
                    shipment_instruction.id = '".$id_final_inspection."'
                group by
                    shipment_instruction.id,
                    shipment_instruction.po    
                ) as inspection_total
                inner join po on
                    po.po = inspection_total.po
                inner join po_item 
                    on po.po = po_item.po
                inner join brand on
                    po.id_brand = brand.id
                left join style_combination on 
                    style_combination.id = po_item.id_combination

                left join classification_faults on
                    classification_faults.ini_pairs <= inspection_total.total_pairs AND 
                    classification_faults.fin_pairs >= inspection_total.total_pairs;
                    ";
                    return ($rs = mysql_query($query)) ? $rs : 'ERROR: '.mysql_error();
        }


        function final_inspection_update_schedule($id_final_inspection,$id_user,$comments,$check_list,$status,$total_mn){

            $query="
            UPDATE style_schedule SET
                conf = now(),
                status = '".$status."',
                id_user = '".$id_user."',
                form_information = '".$check_list."',
                comments = '".$comments."'
            WHERE
                id_final_inspection = '".$id_final_inspection."';
            ";

            return ($rs = mysql_query($query)) ? 'Updated successfully!' : 'ERROR: '.mysql_error();

        }

        function update_pictures($id_inspection,$description){

            $query="
            UPDATE style_schedule_image SET
                description = '".$description."'
            WHERE
                id = '".$id_inspection."';
            ";
            print $query;
            return ($rs = mysql_query($query)) ? 'Updated successfully!' : 'ERROR: '.mysql_error();

        }

        function select_schedule_final($id_final_inspection){

            $query = "
            select
                style_schedule.id
            from
                style_schedule
            where
                style_schedule.id_final_inspection = '".$id_final_inspection."';
            ";

            return ($rs = mysql_query($query)) ? $rs : 'ERROR: '.mysql_error();
        }

        function schedule_id($id_final_inspection){

            $query = "
            select
                style_schedule.id
            from
                style_schedule
            where
                style_schedule.id_final_inspection = '".$id_final_inspection."';
            ";

            return ($rs = mysql_query($query)) ? $rs : 'ERROR: '.mysql_error();
        }



    }

    ?>

您不能簡單地在html中運行sql查詢。 您必須使用php連接到sql

在這里您可以找到如何通過php連接到sql數據庫

在這里您可以找到如何從html更新字段

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM