Jump to content
MakeWebGames

Recommended Posts

Posted

Ok got a bit of a brain freeze and this thing is annoing me....

 

<?php
include "globals.php";
global $db,$r,$c,$userid;
$_GET['u'] = abs((int) $_GET['u']);
if(!$_GET['u'])
{
print "Invalid use of file";
}
else
{
$video=$db->query("SELECT * FROM videos WHERE videoID={$_GET['u']}",$c);
if($db->fetch_row($video) == 0)
{
print "There is no such video!";
}
else
{
$q=$db->query("SELECT playerswflink, videophplink, width, height, allowaccess FROM videos ",$c);
$db->fetch_row($q);
print "video Artist {$r['name']} Track Title {$r['title']} added.

<h1>Preview</h1>


<center><embed src='{$r['playerswflink']}' width='$width' height='$height' allowsiptallowaccess='{$r['videophplink']}' allowfullseen='true' flashvars='height=$height&width=$width&file={$r['videophplink']}$videoidlink&backcolor=0x000000&frontcolor=0xFFFFFF&lightcolor=0xCC0000&displayheight=$height&autostart='{$r['autostart']}'/></a></embed></center>
";

}
}
$h->endpage();
?>

 

The $'s are not being placed into the script neither is the {$r['playerswflink']} can anyone tell me what im doing wrong here its annoying me

as you can see here from the Source code from the webpage you will see that '' isnt being inserted

<embed src='' width='' height='' allowsiptallowaccess='' allowfullseen='true' flashvars='height=&width=&file=&backcolor=0x000000&frontcolor=0xFFFFFF&lightcolor=0xCC0000&displayheight=&autostart='/></a></embed>

Posted

Re: adding php to an embed code ?

Try swapping out this:

$q=$db->query("SELECT playerswflink, videophplink, width, height, allowaccess FROM videos ",$c);
$db->fetch_row($q);

 

with this:

$q=$db->query("SELECT playerswflink, videophplink, width, height, allowaccess FROM videos ",$c);
$r = $db->fetch_row($q);

 

Specifically: set a value for the $r variable.

Hope that helps...

Posted

Re: adding php to an embed code ?

I think he means the value of the php variables inserted into the tag <embed>

<embed src='' width='' height='' allowsiptallowaccess='' allowfullseen='true' flashvars='height=&width=&file=&backcolor=0x000000&frontcolor=0xFFFFFF&lightcolor=0xCC0000&displayheight=&autostart='/></a></embed>

In that case Floydian's reply would probably help you.

If you are trying to insert something in your database you should give more info because it isn't really clear.

Posted

Re: adding php to an embed code ?

ok i a nut shell ive mad the admin center so staff can insert the link for swf + the php page + height width allowaccess,,

What i need is for when a user selects the required link from the video page the video opens up with the links added to the SQL

Except that the links are blank. here is my full script for the users...

videos.php

<?php
include "globals.php";
$_GET['st'] = abs((int) $_GET['st']);
$st=($_GET['st']) ? $_GET['st'] : 0;
$by=($_GET['by']) ? $_GET['by'] : 'tracktitle';
$ord=($_GET['ord']) ? $_GET['ord'] : 'ASC';
print "<h3>Userlist</h3>";
$cnt=$db->query("SELECT tracktitle FROM videos",$c);
$membs=mysql_num_rows($cnt);
$pages=(int) ($membs/100)+1;
if($membs % 100 == 0)
{
$pages--;
}
print "Pages: ";
for($i=1;$i <= $pages;$i++)
{
$stl=($i-1)*100;
print "[url='videos.php?st=$stl&by=$by&ord=$ord']$i[/url] ";
}
print "

Order By: [url='videos.php?st=$st&by=videoalphabet&ord=$ord']Alphabet Letter[/url] | [url='videos.php?st=$st&by=artist&ord=$ord']artist[/url] | [url='videos.php?st=$st&by=tracktitle&ord=$ord']Track Title[/url]

[url='videos.php?st=$st&by=$by&ord=asc']Ascending[/url] | [url='videos.php?st=$st&by=$by&ord=desc']Descending[/url]

";
$q=$db->query("SELECT * FROM videos ORDER BY $by $ord LIMIT $st,100");
$no1=$st+1;
$no2=$st+100;
print "Showing Videos $no1 to $no2 by order of $by $ord.
<table width=75% cellspacing=1 class='table'><tr style='background:gray'><th>Track Name</th><th>Artists Name</th><th>Letter</th></tr>";
while($r=$db->fetch_row($q))
{
$d="";
if($r['tracktitle']) { $r['artist'] = "<font color=yellow>{$r['artist']}</font>";$d=""; }
print "<tr><td>{$r['tracktitle']}</td><td>[url='playvideo.php?u={$r[']{$r['artist']}[/url]</td><td>{$r['videoalphabet']}</td>";

print "</td></tr>";
}
print "</table>";

$h->endpage();
?>

 

playvideo.php

 

<?php
include "globals.php";
global $db,$r,$c,$userid;
$_GET['u'] = abs((int) $_GET['u']);
if(!$_GET['u'])
{
print "Invalid use of file";
}
else
{
$video=$db->query("SELECT * FROM videos WHERE videoID={$_GET['u']}",$c);
if($db->fetch_row($video) == 0)
{
print "There is no such video!";
}
else
{
$r=$db->query("SELECT playerswflink, videophplink, width, height, allowaccess FROM videos ",$c);
$db->fetch_row($r);
print "video Artist {$r['name']} Track Title {$r['title']} added.

<h1>Preview</h1>


<center><embed src='{$r['playerswflink']}' width='$width' height='$height' allowsiptallowaccess='{$r['videophplink']}' allowfullseen='true' flashvars='height=$height&width=$width&file={$r['videophplink']}$videoidlink&backcolor=0x000000&frontcolor=0xFFFFFF&lightcolor=0xCC0000&displayheight=$height&autostart='{$r['autostart']}'/></a></embed></center>
";
//$db->query("UPDATE videos SET videoVIEWS=videoVIEWS+1 WHERE videoID={$_GET['u']}");
}
}
$h->endpage();
?>
Posted

Re: adding php to an embed code ?

like Floydian said (in playvideo.php)

$r=$db->query("SELECT playerswflink, videophplink, width, height, allowaccess FROM videos ",$c);
$db->fetch_row($r);

should be

$q=$db->query("SELECT playerswflink, videophplink, width, height, allowaccess FROM videos ",$c);
$r = $db->fetch_row($q);

try that

Posted

Re: adding php to an embed code ?

There's nothing wrong with the SQL? try "SELECT * FROM videos WHERE videoID=someid"

in phpmyadmin or another mysql client.

it is 'videoID' right? not 'videoid' I made that mistake myself a couple of times :)

Glad you fixed it

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...