Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 24, 2012, 11:49:19 AM

Pages: [1]   Go Down
  Print  
Author Topic: How to select an individual entry from a db  (Read 1281 times)
ndogg
Intergalactic Superstar
*****
Offline Offline

Posts: 195


« on: March 09, 2011, 03:08:09 PM »

This is my first time creating a database, and I have what I think is a very simple question.

I want my database to show youtube videos via PHP. I have already created the database with two columns: one for the ID (called "id") and for the youtube video database entry ("yt"). I have it show the table ("video") of my entries with the following code:

Code:
<?php 
 
// Connects to your Database 
 
mysql_connect("localhost""username""password") or die(mysql_error()); 
 
mysql_select_db("table") or die(mysql_error()); 
 
$data mysql_query("SELECT * FROM video"
 or die(
mysql_error()); 
 Print 
"<table border cellpadding=3>"
 while(
$info mysql_fetch_array$data )) 
 { 
 Print 
"<tr>"
 Print 
"<th>ID:</th> <td>".$info['id'] . "</td> "
 Print 
"<th>Video:</th> <td>".$info['yt'] . " </td></tr>"
 } 
 Print 
"</table>"
 
?>


How to I select an individual entry and have it get the youtube database entry, so I can embed one video on one page with a URL something like entry.php?id=# display the corresponding "yt" info?
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: