Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 单击“发布”后未显示发布更新_Php_Jquery_Mysql - Fatal编程技术网

Php 单击“发布”后未显示发布更新

Php 单击“发布”后未显示发布更新,php,jquery,mysql,Php,Jquery,Mysql,我刚从下载了一个墙脚本,我将所有内容都设置到了我的数据库中。当我运行我的程序时,当我在文本框中键入内容并单击“发布”时,它显示良好,但不显示任何内容 当我签入phpMyAdmin时,我在文本框中键入了一些消息,但在单击“发布”后,这些消息并没有显示在墙上,而是显示在数据库中 下面是update.php的代码: <?php require_once "config.php"; require_once "helper.php"; $data = array();

我刚从下载了一个墙脚本,我将所有内容都设置到了我的数据库中。当我运行我的程序时,当我在文本框中键入内容并单击“发布”时,它显示良好,但不显示任何内容

当我签入phpMyAdmin时,我在文本框中键入了一些消息,但在单击“发布”后,这些消息并没有显示在墙上,而是显示在数据库中

下面是
update.php
的代码:

<?php
    require_once "config.php";
    require_once "helper.php";

    $data = array();
    if(isset($_POST)) {
        $type = $_POST['shareType'];
        $data[':message'] = $_POST['message'];
        $data[':type'] = $_POST['shareType'];
        $data[':location'] = ($type == 'location') ? $_POST['location'] : '';
        $data[':lat'] = ($type == 'location') ? $_POST['lat'] : ''; 
        $data[':lng'] = ($type == 'location') ? $_POST['lng'] : ''; 
        $data[':user_id'] = 1; 
        $data[':video_url'] = ($type == 'videos') ? $_POST['videoUrl'] : '';
        $data[':created'] = time();
        $data[':image'] = '';
        //For image upload
        if($type == 'photos' && !empty($_FILES['image'])) {
            $file_exts = array("jpg", "bmp", "jpeg", "gif", "png");
            $upload_exts = end(explode(".", $_FILES["image"]["name"]));
            if ((($_FILES["image"]["type"] == "image/gif")
            || ($_FILES["image"]["type"] == "image/jpeg")
            || ($_FILES["image"]["type"] == "image/png")
            || ($_FILES["image"]["type"] == "image/pjpeg"))
            && ($_FILES["image"]["size"] < 2000000)
            && in_array($upload_exts, $file_exts))
            {
                $data[':image'] = time().'.jpg';
                move_uploaded_file($_FILES['image']['tmp_name'], 'uploads/'.$data[':image']);
            }
        }
        // End
        $stmt = $db->prepare("INSERT INTO post (user_id, created, type, message, location, lat, lng, image, video_url) VALUES (:user_id, :created, :type, :message, :location, :lat, :lng, :image, :video_url)");
        if($stmt->execute($data)) {
            $id = $db->lastInsertId();
            $stmt = $db->prepare('SELECT * FROM post where id=:id');
            $stmt->execute(array(':id' => $id));
            if($stmt->rowCount() > 0) {
                $row = $stmt->fetch(PDO::FETCH_ASSOC);

            }
        }

        // Templating
        $template = '';
        if(!empty($row)){
            $template .= '<li><div class="timeline-panel">';
            $template .= '<div class="timeline-header">
                            <div class="row">
                                <div class="col-xs-2">
                                  <img class="img-responsive img-rounded" src="http://0.gravatar.com/avatar/43a5669f2e4d2342701ed560d453a0dd?s=50&d=&r=G">
                                </div>
                                <div class="col-xs-8">
                                  <a>Azhagupandian </a> shared '.time_passed($row['created']).'
                                </div>
                              </div>
                        </div>';
          $media = '';
          if($row['type'] === 'photos') {
              $script = $_SERVER['SCRIPT_NAME'];
              $media = '<img class="img-responsive" src="timthumb.php?src='.dirname($script).'/uploads/'.$row['image'].'&w=456&h=300&q=100&s" />';
          } else if($row['type'] === 'location'){
            $media = '<img class="img-responsive" src="http://maps.googleapis.com/maps/api/staticmap?size=500x150&maptype=roadmap\&markers=size:mid%7Ccolor:red%7C'.$row['lat'].','.$row['lng'].'&zoom=7&sensor=false" />';
          } else if($row['type'] === 'videos') {
              $vType = videoType($row['video_url']);
              if($vType === 'youtube'){
                $id = get_youtube_video_id($row['video_url']);
                $media = '<div class="videowrapper">
                  <iframe height="300" src="http://www.youtube.com/embed/'.$id.'" frameborder="0" allowfullscreen></iframe>
                </div>';
              }
              else if($vType === 'vimeo') {
                $id = get_vimeo_video_id($row['video_url']);
                $media = '<div class="videowrapper">
                  <iframe src="http://player.vimeo.com/video/'.$id.'" height="300" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
                </div>';
              }
          }
          $template .= '<div class="timeline-heading">
                           '.$media.'         
                          </div>';
          $template .= '<div class="timeline-body"><p>
              '.$row['message'].'</p>
            </div>';
          $template .= '</div></li>'; 
        }
        echo $template;
    }

?>


你是使用长轮询来获取新数据还是只是刷新文档哦男孩
如果(isset($\u POST))
@Class抱歉,但我仍然不明白你的意思:(@Tyranicangel:不,这个脚本不是只刷新…@user3553704
$\u POST
和其他超全局设置总是被设置的