There is the code i wanted to use to echo out HTML table with som PHP in it.
echo '<table class="table table-bordered" style="margin-top: 50px;">
<tr>
<?php
$select="select * from videos";
$result=mysqli_query($con,$select);
?>
<!--<th colspan="4"><h2>Student Record</h2></th> -->
</tr>
<th> Video </th>
<th> Názov </th>
<th> Autor </th>
<th> Tagy </th>
<th> Žáner </th>
<th> Hodnotenie </th>
<th> Rozlíšenie videa </th>
<th> Počet Snímkov </th>
<th> Dĺžka videa</th>
<th> Dátum Vytvorenia </th>
</tr>
<tr>
<td><video src='".$location."' controls width='320px' height='320px' ></video></td>
<td><?php echo $rows['FileName']; ?></td>
<td><?php echo $rows['author']; ?></td>
<td><?php echo $rows['tags']; ?></td>
<td><?php echo $rows['genre']; ?></td>
<td><?php echo $rows['rating']; ?></td>
<td><?php echo $rows['ImageSize']; ?></td>
<td><?php echo $rows['VideoFrameRate']; ?></td>
<td><?php echo $rows['MediaDuration']; ?></td>
<td><?php echo $rows['CreateDate']; ?></td>
</tr>
<?php
}
?>
</table> ';
I have trouble with the part where im trying to use PHP again
<tr>
<td><video src='".$location."' controls width='320px' height='320px' ></video></td>
<td><?php echo $rows['FileName']; ?></td>
<td><?php echo $rows['author']; ?></td>
<td><?php echo $rows['tags']; ?></td>
<td><?php echo $rows['genre']; ?></td>
<td><?php echo $rows['rating']; ?></td>
<td><?php echo $rows['ImageSize']; ?></td>
<td><?php echo $rows['VideoFrameRate']; ?></td>
<td><?php echo $rows['MediaDuration']; ?></td>
<td><?php echo $rows['CreateDate']; ?></td>
</tr>
I wanted to echo out HTML table with some php in it.
There is the syntax error im getting:
syntax error, unexpected double-quote mark, expecting "," or ";"
2
Answers
This should work:
But I’d suggest you learn how to mix html with php.
First try to only output the data with php (everything inside a single
<?php … ?>
) and not using any html.Then in the next step you could try mixing in the html. Go slow and step by step. This way you will notice, when you made a syntax error.
It’s because your are echoing
$
as comment not a variable. You should need the use of backtick(`).echo `$ >youre codes here< $`;