dsqbkh3630 2013-03-27 14:29
浏览 127
已采纳

解析错误:语法错误,第83行的C:\ xampp \ htdocs \ eg \ submit.php中的文件意外结束[关闭]

<html>
<body>

<?php include("header.php"); ?>
   <?php include("menu.php"); ?>
   <?php
$host = 'localhost';
$user = 'root';
$password = '';

$database = 'egov';

$conn = mysql_connect($host,$user,$password) or die('Server Information is not Correct');
mysql_select_db($database,$conn) or die('Database Information is not correct');


$sql = "CREATE TABLE IF NOT EXISTS  'upload'(file_id INT(11) NOT NULL,fName VARCHAR(255) NOT NULL,lName VARCHAR(255) NOT NULL,Mo INT(11) NOT NULL,dese VARCHAR(255) NOT NULL,Email VARCHAR(255) NOT NULL,file_name VARCHAR(255) NOT NULL,PRIMARY KEY(file_id))ENGINE = MYISAM";


if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)
{
$fileName = $_FILES['userfile']['name'];
$tmpName  = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$fp      = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);

if(!get_magic_quotes_gpc())
{
    $fileName = addslashes($fileName);
}


$da = date("dmy");
echo $da;



$fname = $_REQUEST['lastname'];
$lname = $_REQUEST['firstname'];
$pno = $_REQUEST['mbo'];
$email = $_REQUEST['email'];
$query = $_REQUEST['description'];




$sql = "INSERT INTO upload (
                    fName,
                    lName,
                    Mo,
                    dese,
                    Email                   
                )
                VALUES (
                    '$fname',
                    '$lname',
                    '$pno',
                    '$email',
                    '$query ',
                    'file_name',
                    NOW()
                )";





include'index.php';


?>
<?php include("copyrights.php"); ?> 

            </div>
    </div>
</body>
</html>

please some one help me am getting an parse error while inserting data into mysql database through my script

ive also changed its code like to:

?>

still not working... its showing the same error as unexpected ending and thanks in advance ........

  • 写回答

1条回答 默认 最新

  • dongluan2612 2013-03-27 14:35
    关注

    Ending the if (isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) as @MarkoD pointed out will resolve the unexpected end of file:

    <?php
    include("header.php");
    ?>
       <?php
    include("menu.php");
    ?>
       <?php
    $host     = 'localhost';
    $user     = 'root';
    $password = '';
    
    $database = 'egov';
    
    $conn = mysql_connect($host, $user, $password) or die('Server Information is not Correct');
    mysql_select_db($database, $conn) or die('Database Information is not correct');
    
    
    $sql = "CREATE TABLE IF NOT EXISTS  'upload'(file_id INT(11) NOT NULL,fName VARCHAR(255) NOT NULL,lName VARCHAR(255) NOT NULL,Mo INT(11) NOT NULL,dese VARCHAR(255) NOT NULL,Email VARCHAR(255) NOT NULL,file_name VARCHAR(255) NOT NULL,PRIMARY KEY(file_id))ENGINE = MYISAM";
    
    
    if (isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) {
        $fileName = $_FILES['userfile']['name'];
        $tmpName  = $_FILES['userfile']['tmp_name'];
        $fileSize = $_FILES['userfile']['size'];
        $fileType = $_FILES['userfile']['type'];
    
        $fp      = fopen($tmpName, 'r');
        $content = fread($fp, filesize($tmpName));
        $content = addslashes($content);
        fclose($fp);
    
        if (!get_magic_quotes_gpc()) {
            $fileName = addslashes($fileName);
        }
    
    
        $da = date("dmy");
        echo $da;
    
    
    
        $fname = $_REQUEST['lastname'];
        $lname = $_REQUEST['firstname'];
        $pno   = $_REQUEST['mbo'];
        $email = $_REQUEST['email'];
        $query = $_REQUEST['description'];
    
    
    
    
        $sql = "INSERT INTO upload (
                        fName,
                        lName,
                        Mo,
                        dese,
                        Email                   
                    )
                    VALUES (
                        '$fname',
                        '$lname',
                        '$pno',
                        '$email',
                        '$query ',
                        'file_name',
                        NOW()
                    )";
    
    
    }
    
    
    include 'index.php';
    
    
    ?>
    <?php
    include("copyrights.php");
    ?> 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?