/    Sign up×
Community /Pin to ProfileBookmark

Whats wrong with this code

Code below was supposed to play all the videos in the db
but only shows the quicktime player but does not plays it

[code=php]<?php

$con = mysql_connect(“localhost”,”root”,””);
if(!$con)
die(mysql_error());

if(!mysql_select_db(sgw))
die(“cant connect db”);

$query = “select name from video order by id desc”;

$result = mysql_query($query);
$num = mysql_num_rows($result);

if($num == 0)
{
echo ‘<script type=”text/javascript>
<!–
alert(“No Video Available, Why dont you post some.”);
document.location=”../test/upload.php”;
–>
</script>’;
}
while($row=mysql_fetch_array($result))
{
echo ‘
<object width=”400″ height=”320″
classid=”clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B”
codebase=”http://www.apple.com/qtactivex/qtplugin.cab”>
<param name=”src” value=”‘ . $row[‘name’] . ‘”>
<param name=”autoplay” value=”true”>
<param name=”controller” value=”false”>
<embed src=”‘ . $row[‘name’] . ‘” width=”400″ height=”320″
autoplay=”true” controller=”true”
pluginspage=”http://www.apple.com/quicktime/download/”>
</embed>

</object><br/> ‘;

}

?>[/code]

to post a comment
HTML

2 Comments(s)

Copy linkTweet thisAlerts:
@kiwibritNov 25.2009 — You're really asking in the wrong section - the php one would be better. From a quick glance, I would say your logic is wrong. The player needs to know which record to play - and I think isn't told until the row in which there is a false result. If you want to play each video, you should call the first record, then increment the counter and pull the second record and play that, and so on until there is no more.
Copy linkTweet thisAlerts:
@criterion9Nov 25.2009 — What is the html output (view source from browser)? Does the "name" field in the db point to the actual file or does it reside in another folder from the script in question?

I agree that this is a PHP question and not one relating to HTML and should be moved to the PHP forum.
×

Success!

Help @raul_8 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...