user3564060
user3564060

Reputation: 11

PHP video "in the database"

I'm trying to display a video using wamp and php. I'm storing the name of the video "trailer.MP4" in the database, the attribute that stores it is called VIDEO.

<body>
<?php 
$tituloPagina= 'PELICULAS';
include ('encabezado.php');
include("conexion.php");
$link =Conectarse();
$s = oci_parse($link, "select * from pelicula");
oci_execute($s);

echo "<table border=1 align='center'> ";
echo "<th> NUM </th> <th> NOMBRE </th> <th> DESCRIPCION </th> <th> EST</th> <th> CLAS</th><th> TRAILER </th> <th> EDIT </th> <th> DEL</th> <TR>";
while ($row = oci_fetch_array($s)) {    
        $id =$row['ID_PELICULA'];
      echo "<td>".$id."</td>";
      echo "<td>".$row['NOMBRE']."</td>";
      echo "<td>".$row['SINOPSIS']."</td>";
      echo "<td>".$row['PROMOCION']."</td>";
      echo "<td>".$row['CLASIFICACION']."</td>";

 echo "<td><video width="320" height="240" controls><source src=".$row['VIDEO']." type="video/mp4"></video></td>";

When reloading the site it shows: Parse Error on video tag line

The video trailer.mp4 is on the root folder for the php and website files.

I'm new to this so I feel like I'm in the dark while trying this... Got it as an assignment without any prior knowledge about the subject.

Upvotes: 0

Views: 59

Answers (1)

Robert
Robert

Reputation: 20286

It's very easy to track this error because it's error in the syntax

change

echo "<td><video width="320" height="240" controls><source src=".$row['VIDEO']" type="video/mp4"></video></td>";

to

echo "<td><video width="320" height="240" controls><source src=" . $row['VIDEO'] . " type="video/mp4"></video></td>";

You've missed a dot.

Moreover you have literal mistake in table attribute it should be called align you have aling even better if you used css "text-align: center", you should format your code better check PSR rules

Upvotes: 1

Related Questions