ello..
i cannot display the video or audio that i already upload in database..why and how should i do??

What have you tried so far ?

Member Avatar for diafol

For a first post that's pretty vague. Care to elaborate?

HAHA.. POST your code and tell us which part is wrong/not workin'

Cheers,

i write this coding to search the file that i already upload...

<title>Cinderella</title>
<style type="text/css">
body {
    background-image: url(cinderella%20bg.png);
    background-repeat: repeat;
}
body,td,th {
    font-family: Verdana, Geneva, sans-serif;
    font-size: 10px;
    color: #FFF;
}
#apDiv1 {
    position:absolute;
    left:271px;
    top:210px;
    width:158px;
    height:69px;
    z-index:1;
}
#apDiv2 {
    position:absolute;
    left:45px;
    top:240px;
    width:172px;
    height:31px;
    z-index:1;
}
#apDiv3 {
    position:absolute;
    left:1007px;
    top:411px;
    width:201px;
    height:172px;
    z-index:1;
}
a:link {
    text-decoration: none;
    color: #FFC;
}
a:visited {
    text-decoration: none;
    color: #FFF;
}
a:hover {
    text-decoration: none;
    color: #FC6;
}
a:active {
    text-decoration: none;
    color: #F99;
}
</style>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

<?php
$db_host = "localhost";
$db_username = "root";
$db_pass = "";
$db_name = "mm_database";

@mysql_connect ("$db_host", "$db_username", "$db_pass") or die ("Could not connect to MySQL");
@mysql_select_db("$db_name") or die ("No database");

$search=$_POST["search"];
$type=$_POST["type"];
$Button = $_POST["button"]; 

$query = mysql_query("SELECT * FROM `mm_database`.`files` WHERE `filename` LIKE '%$search%'");
    if ($query)
    {
    while ($rows = mysql_fetch_array($query)):

        $name = $rows['filename'];
        $dir = $rows['path'];

     echo "<a target='_blank' href=$dir>$name</a> <br>";

    endwhile;
    }
    else
    {
        echo "No result";
    }
?>
</script>

<body onLoad="MM_preloadImages('cinderella (2).png')"><div id="apDiv3">
  <table width="200" border="0">
    <tr>
      <td align="center"><p><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','cinderella (2).png',1)"><img src="cinderella.png" name="Image1" width="174" height="137" border="0" align="middle" /></a></p>
      <h5>Home</h5></td>
    </tr>
  </table>
</div>
<br/></td>
  </tr>
</table>
<p>&nbsp;</p>
<table width="488" height="42" border="0" align="center">
  <tr>
    <td width="482" align="center" bgcolor="#006699"><h1>SEARCH RESULT</h1></td>
  </tr>
</table>
<table width="490" height="500" border="0" align="center">
  <tr>
    <td width="154" height="36" align="center" bgcolor="#006699"><h2>Video Clips</h2></td>
    <td width="166" align="center" bgcolor="#006699"><h2>Audio</h2></td>
    <td width="156" align="center" bgcolor="#006699"><h2>Text</h2></td>
  </tr>
  <tr>
    <td width="154" height="44" align="left" bgcolor="#006699"><h3><a href="A reading of Walt Disneys Cinderella.html">A reading of Walt Disneys Cinderella</a></h3></td>
    <td bgcolor="#006699"><h4><a href="04 - A Dream Is A Wish Your Heart Makes {From Walt Disney's Cinderella}.html">04 - A Dream Is A Wish Your Heart Makes {From Walt Disney's Cinderella}</a></h4></td>
    <td bgcolor="#006699"><h3><strong><a href="Cinderella doc.html">Cinderella</a></strong></h3></td>

  </tr>
  <tr>
    <td height="44" bgcolor="#006699"><h3><a href="Cinderella Full Fandub.html">Cinderella Full Fandub </a></h3></td>
    <td bgcolor="#006699"><h3><a href="Bless Myself - Lucy Hale (A Cinderella Story_ Once Upon a Song).html">Bless Myself - Lucy Hale (A Cinderella Story_ Once Upon a Song)</a></h3></td>
    <td bgcolor="#006699"><h3><a href="A Cinderella Story.html">A Cinderella Story<br />
    Local Designer Bedecks Miss Connecticut</a></h3></td>
  </tr>
  <tr>
    <td height="44" bgcolor="#006699"><h3><a href="Cinderella Full Movie Fandub Part 1.html">Cinderella Full Movie Fandub Part 1</a></h3></td>
    <td bgcolor="#006699"><h3><a href="Brandy - Do I Love You Because You're Beautiful.html">Brandy - Do I Love You Because You're Beautiful</a></h3></td>
    <td bgcolor="#006699"><h3><a href="Read  Cinderella story.html">Read  Cinderella story</a></h3></td>
  </tr>
  <tr>
    <td height="44" bgcolor="#006699"><h3><a href="Cinderella Full Movie Fandub Part 2.html">Cinderella Full Movie Fandub Part 2</a></h3></td>
    <td bgcolor="#006699"><h3><a href="Disney - Wedding Songs - Cinderella - so this is love.html">Disney - Wedding Songs - Cinderella - so this is love</a></h3></td>
    <td bgcolor="#006699"><h3><a href="Household Tales.html">Household story cinderella</a></h3></td>
  </tr>
  <tr>
    <td height="44" bgcolor="#006699"><h3><a href="Fairy Tales - Cinderella - Kids Animation Cartoon Stories.html">Fairy Tales - Cinderella - Kids Animation Cartoon Stories</a></h3></td>
    <td bgcolor="#006699"><h3><a href="Tattoo_Colour_-_Cinderella.html">Tattoo_Colour_-_Cinderella</a></h3></td>
    <td bgcolor="#006699">&nbsp;</td>
  </tr>
  <tr>
    <td height="44" bgcolor="#006699"><h3><a href="Fairy Tales - Cinderella - Kids Animation.html">Fairy Tales - Cinderella - Kids Animation</a></h3></td>
    <td bgcolor="#006699"><h3><a href="Tchaikovsky - 1812 Overture (Orchestral).html">Tchaikovsky - 1812 Overture (Orchestral)</a></h3></td>
    <td bgcolor="#006699">&nbsp;</td>
  </tr>
  <tr>
    <td height="44" bgcolor="#006699"><h3><a href="Fairy Tales - Cinderella - Kids.html">Fairy Tales - Cinderella - Kids</a></h3></td>
    <td bgcolor="#006699">&nbsp;</td>
    <td bgcolor="#006699">&nbsp;</td>
  </tr>
  <tr>
    <td height="44" bgcolor="#006699"><h3><a href="Hello Kitty in Cinderella - Part 1.html">Hello Kitty in Cinderella - Part 1</a></h3></td>
    <td bgcolor="#006699">&nbsp;</td>
    <td bgcolor="#006699">&nbsp;</td>
  </tr>
  <tr>
    <td height="44" bgcolor="#006699"><h3><a href="RankinBass Cinderella Part 1.html">RankinBass Cinderella Part 1</a></h3></td>
    <td bgcolor="#006699">&nbsp;</td>
    <td bgcolor="#006699">&nbsp;</td>
  </tr>
  <tr>
    <td height="44" bgcolor="#006699"><h3><a href="RankinBass Cinderella Part 2.html">RankinBass Cinderella Part 2</a></h3></td>
    <td bgcolor="#006699">&nbsp;</td>
    <td bgcolor="#006699">&nbsp;</td>
  </tr>
</table>
<label></label>
<p>&nbsp;</p>
</body>

and you expect this echo "<a target='_blank' href=$dir>$name</a> <br>"; to deliver your audience the video or the audio?

Shouldn't it be like this?
echo '<a target="_blank" href="'.$dir.$name.'">'.$name.'</a> <br>';

How about the file extension? Is it included in your $name? If not, it should be wiser to find the extension of the file $dir.$name first and then assign the extension to $ext. so that the codes will be
echo '<a target="_blank" href="'.$dir.$name.$ext.'">'.$name.'</a> <br>';

I am assuming here that $dir = "someDirectory/"; and $name = "somefile.whateverext";

If you want the video to play on the page, then you should have a way of delivering the $name.$ext to the next page, so that it will be loaded on the player. The above codes, just gives the browser to download the file and not to play it.

There are so many ways in passing the video info. to the play page.. In fact, the most common is either by $_GET, or by session like in
$_SESSION = $name.$ext; whatever you choose, it has to have the $dir.$name.$ext because player can be different for audio and video.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.