dongsi8812 2013-11-13 22:58
浏览 281

从数据库中获取视频并直接在页面上显示视频,而无需单击链接

Working on a project that involves people signing up to the website and uploading a video,the thing is i have created a file upload form and it works perfect,i head over to the database and check the users table and i see the video uploaded i then head into my php code and initialize the variable:

$Getvid = " "; 

then i fetch the row

while ($row = mysqli_fetch_array($user_query, MYSQLI_ASSOC)) {  $vid = $row ["vid"]; } 

after that i place

$Getvid = '< source src="user/'.$u.'/'.$vid.'" >';
if($vid == NULL) {
    $Getvid = '< source src="image/Movie on 2013-07-24 at 13.43.mov" type="video/mp4" >';
}

to get video files that a user have uploaded and echo it out on he/she page and also if the vid row is null then the script would show a default video that i have stored in the database

after that i echo out the video on the users page

      < video width="320" height="240" controls>
      < source src="< ?php echo $vid; ? > " >
      </video> 

but for some reason the video doesn't show also the default doesn't work unless i source it specially like this:

    <video width="320" height="240" controls>
      <source src="image/Movie on 2013-07-24 at 13.43.mov" type="video/mp4"  >
    </video> 

i really need help i tried googling everything phrase i could thing of and nothing so if anyone could please help me i would appreciate your assistance so much the deadline for my project is creeping up on me and i dont know where to turn next for help...

  • 写回答

2条回答 默认 最新

  • doutany76678 2013-11-13 23:05
    关注

    Two potential sources of the problem, you shouldn't store your files with spaces in their names and you haven't specified a type for your video.

    The SRC should contain a valid URL and therefore you should have %20 or + in your PHP string in stead of the spaces.

    Note: As mentioned by Fisk, your php tags are wrong due to the spacing. You use the PHP echo short-form by replacing

    < ?php echo $vid; ? > 
    by 
    <?= $vid; ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大