Hi All,
This code can be used to view videos which are stored in server.
Table contents are shown using reusable code here.
You have to change only the sql in the below given code.
No need to type the entire code.
Just copy and run.
-----------------------------------------------------------------------------------------------------------
<center>
<?php
include('connect.php');
$query = 'select * from upload';
$result = mysql_query($query);
if (!$result)
{
$message = 'ERROR:' . mysql_error();
return $message;
}
else
{
$i = 0;
echo '<html><body><table border=1 align=center><tr>';
while ($i < mysql_num_fields($result))
{
$meta = mysql_fetch_field($result, $i);
echo '<th>' . ucfirst($meta->name) . '</th>';
$i = $i + 1;
}
echo '<th>View</th></tr>';
$i = 0;
while ($row = mysql_fetch_row($result))
{
echo '<tr>';
$count = count($row);
$y = 0;
$idval='1';
while ($y < $count)
{
$c_row = current($row);
if($y==0)
$idval=$c_row;
echo '<td>' . $c_row . '</td>';
next($row);
$y = $y + 1;
}
echo '<td><a href=videoupload1/'.$idval.'.mp4>View Video</a></td>';
echo '</tr>';
$i = $i + 1;
}
echo '</table></body></html>';
mysql_free_result($result);
}
mysql_close ($con);
?></center>
This code can be used to view videos which are stored in server.
Table contents are shown using reusable code here.
You have to change only the sql in the below given code.
No need to type the entire code.
Just copy and run.
-----------------------------------------------------------------------------------------------------------
<center>
<?php
include('connect.php');
$query = 'select * from upload';
$result = mysql_query($query);
if (!$result)
{
$message = 'ERROR:' . mysql_error();
return $message;
}
else
{
$i = 0;
echo '<html><body><table border=1 align=center><tr>';
while ($i < mysql_num_fields($result))
{
$meta = mysql_fetch_field($result, $i);
echo '<th>' . ucfirst($meta->name) . '</th>';
$i = $i + 1;
}
echo '<th>View</th></tr>';
$i = 0;
while ($row = mysql_fetch_row($result))
{
echo '<tr>';
$count = count($row);
$y = 0;
$idval='1';
while ($y < $count)
{
$c_row = current($row);
if($y==0)
$idval=$c_row;
echo '<td>' . $c_row . '</td>';
next($row);
$y = $y + 1;
}
echo '<td><a href=videoupload1/'.$idval.'.mp4>View Video</a></td>';
echo '</tr>';
$i = $i + 1;
}
echo '</table></body></html>';
mysql_free_result($result);
}
mysql_close ($con);
?></center>
Great article explaining about how best we can Showing videos which are stored in Server using PHP. Best software development company in Toronto
ReplyDelete