Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Need help with comment script for videos
Old 09-15-2007, 10:37 PM Need help with comment script for videos
goheadtry's Avatar
Webmaster Talker

Posts: 730
Name: John
Location: United States of America, California
Trades: 0
I need to know how to do a comment script in php for that I can use on every video on my site but have the comments be per video using mysql. can someone help
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
 
Register now for full access!
Old 09-17-2007, 07:50 AM Re: Need help with comment script for videos
killdude69's Avatar
Average Talker

Posts: 24
Name: Brandon Miller
Trades: 0
If you mean so people can comment on your posted videos, I can. Now, if your videos are on a static page, like an HTML file, you'll have to create a new table for each video and (duh: convert it to a PHP file). Assuming you can create a table and connect to your db,... you do it something like this.

HTML Code:
<form action="[php]<?php echo $_SERVER['PHP_SELF']; ?>[/php]" method="post">
<input type="text" name="name" />
<textarea cols="45" rows="5" name="comment"></textarea>
<input type="submit" name="subcom" value=" Submit Comment " />
</form>
PHP Code:
<?php
  
if(isset($_POST['subcom'])){
    
$sql "INSERT INTO video1_comment (Name, Comment)
             VALUES('
$_POST[name]','$_POST[comment]')";
    
mysql_query($sql);
    
$result mysql_query("SELECT * FROM video1_comment");
    while(
$row=mysql_fetch_array($result))
    {
       echo 
"Name: &nbsp; " $row['Name'];
       echo 
"Comment: &nbsp; " $row['comment'];
    }
?>
I'm pretty sure that you know how to change this for your own needs.

I hope this is what your looking for.

If you have posted the videos with PHP and MySQL then I will give you the script for that.

Last edited by killdude69; 09-17-2007 at 07:52 AM..
killdude69 is offline
Reply With Quote
View Public Profile
 
Old 09-17-2007, 10:44 AM Re: Need help with comment script for videos
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Gah 'killdude69' got in there before me

It's true what he put, but don't put the '[php]' and '[\php]' parts.

On that bombshell I can also recommends a bit a AJAX, try something like:

HTML Code:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" target="funiframe">
<input type="text" name="name" />
<textarea cols="45" rows="5" name="comment"></textarea>
<input type="submit" name="subcom" value=" Submit Comment " />
<iframe name="funiframe" id="funiframe" src="" style="visibility: hidden;"></iframe>
</form>
Using the above code can mean the user never needs to leave the page
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 09-17-2007, 10:49 PM Re: Need help with comment script for videos
killdude69's Avatar
Average Talker

Posts: 24
Name: Brandon Miller
Trades: 0
now if the videos were inserted into a database instead of embeded into a static page, it would be more like: (the id is in thre URL)
PHP Code:
<?php
  $id 
$_GET['id'];
?>
HTML Code:
<-- for goes here, it is on the same page as the processing script. -->
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  <input type="text" name="name" />
  <input type="hidden" name="id" value="<?php echo $id; ?>" />
  <textarea name="comment" cols="45" rows="5"></textarea>
</form>
PHP Code:
<?php
  
//id: not null, auto_increment, int(4)
  
$sql "INSERT INTO videos (Name, Comment, Id) WHERE id = $id
           VALUES('
$_POST[name]','$_POST[comment]','$_POST[id]')";
  
mysql_query($sql);
  
$result=mysql_query("SELECT * FROM video WHERE id = $id");
  
$row=mysql_fetch_array($video);
  
//video display
?>
<table border="0">
 <tr>
  <td align="center"><?php echo $row['video_embed']; ?></td>
 </tr>
</table>
<br /><br />
<table border=0>
 <tr>
  <th>Name: </th>
  <th>Comment: </th>
 </tr>
<?php
  $result
=mysql_query("SELECT * FROM video_comment WHERE id=$id");
  while(
$row=mysql_fetch_array($result)){
?>
 <tr>
  <td><?php echo $row['Name']; ?></td>
 </tr>
 <tr>
  <td align="center"><?php echo $row['Comment']; ?></td>
 </tr>
<?php ?>
</table>
Hope this helped!
killdude69 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Need help with comment script for videos
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13494 seconds with 12 queries