User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 373,936 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,612 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

How to include FLV videos in php

Join Date: Apr 2008
Posts: 43
Reputation: Daedal is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 11
Daedal's Avatar
Daedal Daedal is offline Offline
Light Poster

Re: How to include FLV videos in php

  #2  
Apr 9th, 2008
Originally Posted by saji.ka View Post
Dear All,

I am new to PHP. I would like to include video (Flash Videos) in the website using PHP. Can u please help by giving the code.

Saji


Here is code from a previous project of mine. Use as much or as little as you want. The function I have included really only uses 5 fields:
videoID
status
title
caption
embed_code

MySQL Videos Table
DROP TABLE IF EXISTS `videos`;
CREATE TABLE `videos` (
  `videoID` mediumint(8) unsigned NOT NULL auto_increment,
  `status` enum('Active','Disabled') NOT NULL default 'Active',
  `title` varchar(35) default NULL,
  `caption` text,
  `category` varchar(35) default NULL,
  `filename` varchar(35) default NULL,
  `embed_code` text,
  `video_date` date NOT NULL default '0000-00-00',
  PRIMARY KEY  (`videoID`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;

-- 
-- Dumping data for table `videos`
-- 

INSERT INTO `videos` (`videoID`, `status`, `title`, `caption`, `category`, `filename`, `embed_code`, `video_date`) VALUES (1, 'Active', 'Lonely Angel', 'Kid Theodore''s Lonely Angel music video', 'www.kidtheodore.com', NULL, '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/l5os6oII8Hk"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/l5os6oII8Hk" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', '2007-10-25')

PHP function to call the information from the database.
You would need to connect to your database first.

function getVideo($vid) {
//$vid = a videoID in the table videos
	$query = "SELECT * FROM videos WHERE status = 'Active' AND videoID = '$vid'"; 
	$result = mysql_query($query); 
  	  if (mysql_num_rows($result) > 0) {		
		$row = mysql_fetch_array( $result );
			$output .= "
			<h2>$row[title]</h2>
			$row[embed_code]<br>
			$row[caption]
			";
	  } else {
	  $output = "No video was found at this time.<br> Please check back soon.<br>";
	  }

			
return $output;
} //usage //echo getVideo($vid); 

Reply With Quote  
All times are GMT -4. The time now is 6:35 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC