1

我正在为我的网站设置分类广告,但我发现自己又“卡住”了。

我是 PHP 新手,但我正在为分类广告和我将在下面提供的脚本开发一个更好的鼠标陷阱,我完全从头开始编写并且它可以工作。(将数据上传到数据库)但是当我添加以以下开头的 if 块时: if($_POST['Image 1'] != "") { 整个事情都崩溃了。(我得到一个没有错误消息或任何东西的白屏)。

这是此页面的完整代码;

<?php
    ob_start();
    session_start();
    require_once('z-mysql_ini.php');
    require ('z-connect.php');

    $mysql = new mysql();       

    if($_POST['Description'] != "") {
        $TypeID = $_POST['TypeID'];     
        $FatherID = $_POST['fatherID'];
        $Model = $_POST['Model'];
        $Price = $_POST['Price'];
        $Description = $_POST['Description'];
        $Year = $_POST['Year'];     
        $VIN = $_POST['VIN'];
        $Address = $_POST['Address'];
        $City = $_POST['City'];
        $State = $_POST['State'];
        $ZIP = $_POST['ZIP'];
        $Country = $_POST['Country'];
        $Email = $_POST['Email'];
        $Phone = $_POST['Phone'];       
        $InformOfUpdates = $_POST['Inform'];
        }   

        $node = new sqlNode();
        $node->table = sprintf("`tt_%s`", abs(intval($_POST['TypeID'])));
        $node->push("int", "CategoryID", $FatherID);    
        $node->push("int", "MemberID", $_SESSION['memberID']);
        $node->push("text", "Model", strtoupper($Model));       
        $node->push("int", "Price ($)", $Price);
        $node->push("text", "Description", $Description);
        $node->push("int", "Year", $Year);
        $node->push("text", "VIN", $VIN);
        $node->push("defined","PostDate","NOW()");
        $node->push("text","Featured","yes");
        $node->push("defined","ExpireDate","DATE_ADD(NOW(),INTERVAL 30 DAY)");
        $node->push("text", "Address", $Address);
        $node->push("text", "City", $City);
        $node->push("text", "State/Province", $State);
        $node->push("text", "ZIP/Postal", $ZIP);
        $node->push("text", "Country", $Country);
        //$node->push("text", "Email", $Email);
        //$node->push("text", "Phone", $Phone);     
        $node->push("int", "Inform", $InformOfUpdates);

        if(($result = $mysql->insert($node)) === false) {
            echo mysql_error();
            echo 'Unable to Insert Data'; 
            } else {
                $ListingID = mysql_insert_id();
                }

                if($_POST['Image 1'] != "") {   
                    echo 'File Selected and Data set in DB';
                    } else{
                        echo 'No File Selcted but Data Inserted';

                        //header("Location:memberindex.php");
                    }
                    }               

            ?>

如果有人能告诉我我做错了什么导致页面崩溃,我将不胜感激,因为我可以继续重新实现分类广告附带的图像上传代码,但我什至不能在页面不死机的情况下通过这个初始的测试代码块(并且不上传到数据库。

底线是,如果我完全从页面中删除以下代码,脚本会将上面的所有变量数据上传到数据库中,但是如果我添加这段代码,整个事情就会崩溃。

if($_POST['Image 1'] != "") {   
                    echo 'File Selected and Data set in DB';
                    } else{
                        echo 'No File Selcted but Data Inserted';

                        //header("Location:memberindex.php");
                    }
4

0 回答 0