•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 402,684 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,372 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
Views: 556 | Replies: 5
![]() |
•
•
•
•
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);
•
•
Join Date: Apr 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
The code worked fine with youtube video. When I replaced with my video it is a FLV file and its name is pv160308.flv, it is not working.
What I did ..
replaced the value="http://www.youtube.com/v/l5os6oII8Hk" and
src=" http://www.youtube.com/v/l5os6oII8Hk"
with local
value="pv160308.flv" and
src= "pv160308.flv".
When executed . no display is coming.
Could u pl. help
Saji
•
•
•
•
The code worked fine with youtube video. When I replaced with my video it is a FLV file and its name is pv160308.flv, it is not working.
What I did ..
replaced the value="http://www.youtube.com/v/l5os6oII8Hk" and
src=" http://www.youtube.com/v/l5os6oII8Hk"
with local
value="pv160308.flv" and
src= "pv160308.flv".
When executed . no display is coming.
Could u pl. help
Saji
I guess I misunderstood the question. You need to create an Adobe Flash FLV player... which would be a SWF file that has controls (play pause rewind) You could create this file to use a FLASHVAR to name the FLV file that you want to load in.
Ex:
src= "flvplayer.swf?video=pv160308.flv"
There would be a variable in your flash file called 'video' that it would load onto the scene.
•
•
Join Date: Aug 2007
Location: Cavite,Philippines
Posts: 507
Reputation:
Rep Power: 3
Solved Threads: 68
you can try JW flash player.It's free and easy to use.
"death is the cure of all diseases..."
http://ryantetek.wordpress.com
http://ryantetek.wordpress.com
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: Redirect Output
- Next Thread: Dreamweaver and PHP on the Mac


Linear Mode