Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-09-2012, 05:21 AM   PM User | #1
TLWH05
New to the CF scene

 
Join Date: Nov 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
TLWH05 is an unknown quantity at this point
Get the value of the selected data in database

"Help!"
"I'm a newbie...be gentle"

I have 2 php files: (1) videolist.php (2) watch.php

My problem is i need to run the "watch.php" and post also the title of the video as caption when the title of the video was clicked.

Here's my code "videolist.php":

Code:
<?php
$con = mysql_connect("localhost","usergtf","TLWH05");
	if (!$con)
	{
	die('Could not connect: ' . mysql_error());
	}
	mysql_select_db("dbgtf", $con);
	$result = mysql_query("SELECT * FROM tblvideos");
	?>

<table border="0" bordercolor="#FFFFFF" cellpadding="5" cellspacing="0" align="center">
        <tr id="tableheader" align="left" height="30">
            <th width="10" style="display:none">ID</th>
            <th width="80">DATE</th>
            <th width="200">TIME</th>
            <th width="350">TITLE</th>
        </tr>

<?php
	echo "<tr align='left' height='30' bgColor='#69F'>";
	echo "<td>" . $row['DATE'] . "</td>";
	echo "<td>" . $row['SERVICE'] . "</td>";
	echo "<td>" . $row['TITLE'] . "</td>";
	echo "</tr>";
}
	mysql_close($con);

?> 
</table>
TLWH05 is offline   Reply With Quote
Old 11-09-2012, 08:22 PM   PM User | #2
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
You cannot run two scripts at the same time for the same header request from the user.


But for this, you can have each videos having a unique ID which AUTO INCREMENTs. Then have something like a GET variable. I hope that you know how to pass and extract GET variables from the url.

So each time you fetch the video title, you also fetch the video ID.

So something like this for your above code

PHP Code:
<?php
    
echo "<tr align='left' height='30' bgColor='#69F'>";
    echo 
"<td>" $row['DATE'] . "</td>";
    echo 
"<td>" $row['SERVICE'] . "</td>";
    echo 
"<a href='watch.php?id={$row['id']}'<td>" $row['TITLE'] . "</td>";
    echo 
"</tr>";
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk
Redcoder is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 06:22 AM.


Advertisement
Log in to turn off these ads.