Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Thanked 0 Times in 0 Posts

    Get the value of the selected data in database

    "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":

    $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>
    	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>";

  2. #2
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Thanked 49 Times in 48 Posts
    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:
    echo "<tr align='left' height='30' bgColor='#69F'>";
    "<td>" $row['DATE'] . "</td>";
    "<td>" $row['SERVICE'] . "</td>";
    "<a href='watch.php?id={$row['id']}'<td>" $row['TITLE'] . "</td>";


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts