PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Fri Feb 03, 2006 12:55 am
Now that I read all of the stuff that Jcart told me to do in his post, I am almost there.
Code: Select all
<?php
$username= "muot_video";
$password= "video";
$database= "muot_videos";
$connection = mysql_connect('localhost',$username,$password);
$clause = '';
if (!empty($_GET['ID'])) {
$clause = 'WHERE ';
$clause .= (is_numeric($_GET['ID'])
? '`id` '
: '`Fileame` '
);
$clause .= '= \''. mysql_real_escape_string($_GET['ID']) .'\' LIMIT 1';
}
$sql = 'SELECT `Filename` FROM `videos` '. $clause;
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
echo '<EMBED SRC="/pages/videos/'.$row['fileName'].'" AUTOSTART=true></EMBED>';
?>
this is where I am at now.
I get a parse error
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/muot/public_html/newsite/videos/play.php on line 19
Line 19
Code: Select all
<?php
$row = mysql_fetch_assoc($result);
Might have done it wrong but it is what I thought to do.
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Fri Feb 03, 2006 1:00 am
I almost got it.
I am getting the video player now. But it is playing the video that is first on the list.
code as of now
Code: Select all
<?php
$username= "muot_video";
$password= "video";
$database= "muot_videos";
$connection = mysql_connect('localhost',$username,$password);
mysql_select_db($database);
$clause = '';
if (!empty($_GET['ID'])) {
$clause = 'WHERE ';
$clause .= (is_numeric($_GET['ID'])
? '`id` '
: '`Fileame` '
);
$clause .= '= \''. mysql_real_escape_string($_GET['ID']) .'\' LIMIT 1';
}
$sql = 'SELECT `Filename` FROM `videos` '. $clause;
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
echo '<EMBED SRC="/pages/videos/'.$row['Filename'].'" AUTOSTART=true></EMBED>';
?>
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Fri Feb 03, 2006 1:01 am
Code: Select all
<?php
$username= "muot_video";
$password= "video";
$database= "muot_videos";
$connection = mysql_connect('localhost',$username,$password);
mysql_select_db($database);
$clause = '';
if (!empty($_GET['ID'])) {
$clause = 'WHERE ';
$clause .= (is_numeric($_GET['ID'])
? '`id` '
: '`Fileame` '
);
$clause .= '= \''. mysql_real_escape_string($_GET['ID']) .'\' LIMIT 1';
}
$sql = 'SELECT `Filename`, `id` FROM `videos` '. $clause;
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result) == 1) {
$row = mysql_fetch_assoc($result);
echo '<EMBED SRC="/pages/videos/'.$row['Filename'].'" AUTOSTART=true></EMBED>';
}
else {
while ($row = mysql_fetch_assoc($result)) {
echo '<a href="/play.php?id='.$row['id'].'">'.$row['FileName'].'</a> <br />';
}
}
Like I already told you to do..
but this is seriously the last time.. I just want to see this thread finish in the near future
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Fri Feb 03, 2006 1:10 am
I just get a blank white page now.
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Fri Feb 03, 2006 1:13 am
Still white.
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Fri Feb 03, 2006 1:17 am
Code: Select all
<?php
$username= "muot_video";
$password= "video";
$database= "muot_videos";
$connection = mysql_connect('localhost',$username,$password);
mysql_select_db($database);
$clause = '';
if (!empty($_GET['ID'])) {
$clause = 'WHERE ';
$clause .= (is_numeric($_GET['ID'])
? '`id` '
: '`Fileame` '
);
$clause .= '= \''. mysql_real_escape_string($_GET['ID']) .'\' LIMIT 1';
}
$sql = 'SELECT `Filename`, `id` FROM `videos` '. $clause;
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result) == 1) {
$row = mysql_fetch_assoc($result);
echo '<EMBED SRC="/pages/videos/'.$row['Filename'].'" AUTOSTART=true></EMBED>';
}
else {
while ($row = mysql_fetch_assoc($result)) {
echo '<a href="/play.php?id='.$row['id'].'">'.$row['FileName'].'</a> <br />';
}
}
?>
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Fri Feb 03, 2006 1:22 am
html source
if your in IE go to View -> Source
firefox go to View -> Page Source
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Fri Feb 03, 2006 1:23 am
Code: Select all
<a href="/play.php?id=1"></a> <br /><a href="/play.php?id=2"></a> <br /><a href="/play.php?id=3"></a> <br /><a href="/play.php?id=4"></a> <br /><a href="/play.php?id=5"></a> <br /><a href="/play.php?id=6"></a> <br /><a href="/play.php?id=7"></a> <br /><a href="/play.php?id=8"></a> <br /><a href="/play.php?id=9"></a> <br /><a href="/play.php?id=10"></a> <br /><a href="/play.php?id=11"></a> <br /><a href="/play.php?id=12"></a> <br /><a href="/play.php?id=13"></a> <br /><a href="/play.php?id=14"></a> <br />
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Fri Feb 03, 2006 1:25 am
the reason why the link has no name is because
should be
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Fri Feb 03, 2006 1:36 am
This thread is busted. Jcart helped me on MSN and solved it in a jiffy.
Thank You everybody!
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Fri Feb 03, 2006 1:42 am
Finally got around to doing my New Years resolution.. help someone out even though you have school work to do
Anyways, now that thats over, I can go back to being evil..