Php 显示数据库中的默认youtube视频

Php 显示数据库中的默认youtube视频,php,mysql,html,Php,Mysql,Html,我在我的网站上有一个页面,页面顶部有一个youtube播放器,播放器下面是一堆用户可以点击的视频缩略图。单击缩略图在播放器中播放视频 我需要一个youtube视频默认显示在播放器框中。。。这需要是来自数据库的第一个结果 具体内容 在videos.php中,我有我的页眉/页脚和一些其他东西。为了在页面上显示内容,我包括displayvideos.php。视频播放器也在此处声明,并从地址栏获取视频ID: <iframe id="player" width="640" height="385"

我在我的网站上有一个页面,页面顶部有一个youtube播放器,播放器下面是一堆用户可以点击的视频缩略图。单击缩略图在播放器中播放视频

我需要一个youtube视频默认显示在播放器框中。。。这需要是来自数据库的第一个结果

具体内容

videos.php
中,我有我的页眉/页脚和一些其他东西。为了在页面上显示内容,我
包括displayvideos.php
。视频播放器也在此处声明,并从地址栏获取视频ID:

<iframe id="player" width="640" height="385" src="http://www.youtube.com/embed/<?php echo $_GET['id'] ?>?autoplay=1" frameborder="0"></iframe>
之前的某个地方:

<iframe id="player" width="640" height="385" src="http://www.youtube.com/embed/<?php echo $_GET['id'] ?>?autoplay=1" frameborder="0"></iframe>
之前的某个地方:

<iframe id="player" width="640" height="385" src="http://www.youtube.com/embed/<?php echo $_GET['id'] ?>?autoplay=1" frameborder="0"></iframe>

“没有id”部分应使用
检查!isset($\u GET['id'])
空($\u GET['id'])
而不仅仅是
$_获取['id']
,这可能会导致“注意:未定义索引:id”@binaryLV谢谢。不知道我怎么会漏掉这个。应该用
检查“没有id”部分!isset($\u GET['id'])
空($\u GET['id'])
而不仅仅是
$_获取['id']
,这可能会导致“注意:未定义索引:id”@binaryLV谢谢。不知道我怎么会错过。
<?php
  // There is no id or the id is set to default so play the default video
  if(!isset($_GET['id']) || $_GET['id'] == 'default'){
    // Get the first result in the database
    $defaulttubeID = mysql_fetch_assoc(mysql_query("SELECT `videoinfo` FROM `DATABASE`.`TABLE` LIMIT 0,1"));
    // Change the $_GET['id'] variable to our new video id
    $_GET['id'] = $defaulttubeID['videoinfo'];
  }
?>