0

I recently just installed xampp on windows. I'd like to know how I can store video/clips in a database. I have the video clip stored in the htdocs folder and where it says "value" in the xampp database, I place the file directory followed by the file name (C:\xampp\htdocs\firstsite\check_php\helgo.mp4 , however when I refresh and display my work in preview mode, the video doesnt appear and only a text string appears. The type is set to VARCHAR(255).

I have the video in the following file path: C:\xampp\htdocs\firstsite\helgo.mp4. Inside xampp database, the record has the following properties type=VARCHAR(255) function= I leave empty and value= C:\xampp\htdocs\firstsite\helgo.mp4.I have also tried just leaving the value as helgo.mp4. Am I doing something wrong.

how do I get my webpage to correctly display the video?

Yes my testing server is correct and functional. I also use dreamweaver.

INternet Nub
  • 37
  • 2
  • 6
  • *Why* do you want to store video in a database? – zerkms Apr 09 '14 at 21:18
  • do you mean to ask how one goes about embedding a video? Have you google searched "video html5" – Kai Qing Apr 09 '14 at 21:18
  • You use HTML to take your video's URL and display it as a video. http://www.w3schools.com/html/html_videos.asp – Andrew Whatever Apr 09 '14 at 21:19
  • Have it [**uploaded**](http://www.php.net/manual/en/function.move-uploaded-file.php) to a folder and make a reference to it. I.e.: `echo "Video";` I may have screwed up my quotes (*or missed one*), but you get the general idea. Loop through it, and *voilà.* – Funk Forty Niner Apr 09 '14 at 21:20
  • you are saving the windows file path, you need to save the path relative to the websites document root, eg /helgo.mp4. Though i expect your embed code is also incorrect – Steve Apr 09 '14 at 21:21
  • My embed code is correct as it works just fine. I am using dreamweaver's recordset feature to grab the video's file directory from the database but it doesnt work it just appears as string text. It works fine if I grab text and number records from the database just doesnt work when I try and call a video file. – INternet Nub Apr 09 '14 at 23:03
  • @user3514229 Have you tried [**this answer here**](http://stackoverflow.com/a/22974204/) yet? – Funk Forty Niner Apr 09 '14 at 23:31

2 Answers2

3

I don't actually understand what you're trying to ask. But hope these help.

It is possible to store videos in databases. Videos are just binary data and here's how you store binary data into databases.

Binary Data in MySQL

If you are looking to know about how to embed a video into a webpage, you might want to check this out.

Community
  • 1
  • 1
Sanketh
  • 1,129
  • 9
  • 18
2

You can't save the video file in the database, but you can store its filename and can use anywhere in your code using database query.

Example -

1) Create a table name - video_clips (id,file_name,duration,...)
2) Querying this table will give you the details -

SELECT * FROM video_clips;

3) Using a loop you can iterate the output result array and use them in your document and it should be like this -

<video width="320" height="240" controls>
 <source src="<?=$vid['file_name']?>" type="video/mp4"> 
</video>
Parag Tyagi
  • 7,927
  • 2
  • 36
  • 44