Results 1 to 3 of 3

Thread: [RESOLVED]problem outputing result of inner join query using php

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    [RESOLVED]problem outputing result of inner join query using php

    Hi all .I have 2 tables as shown below.
    I run this query in phpmyadmin and i get sets of data.But for some
    reason my phpscript doesn't output any data.

    idyoutube in both tables are the same.
    i have 2 playlists and one video in each but my php script returns nothing!!
    I be happy if some help me fix this phpscript.


    PHP Code:
    select F.idyoutubeF.thumbnail_urlF.titleF.view_countF.comment_countF.embed_status from playlist as P inner join youtubevideos2 as F on F.idyoutube P.idyoutube where playlistname='popsong' 


    PHP Code:
    $server   "localhost"// MySQL hostname
    $username "root"// MySQL username
    $password "????"// MySQL password
    $dbname   "test"// MySQL db name

    $db mysql_connect($server$username$password) or die(mysql_error());
          
    mysql_select_db($dbname) or die(mysql_error());



    $query  "select F.idyoutube, F.thumbnail_url, F.title, F.view_count, F.comment_count, F.embed_status from playlist as P inner join youtubevideos2 as F on F.idyoutube = P.idyoutube where playlistname='$playlistname'";

    $result mysql_query($query) or die('Error, query failed');


    echo 
    '<table width="700" border="0" cellspacing="1" cellpadding="2" align="center">';



    while (
    $row mysql_fetch_assoc($result)) {


       echo 
    '<td width="' $colWidth '%">' 
       
    // echo '<td width="120">' . 
            
    '<a href="./pagingplayer.php?playlistname='.$s.'&videoid='.$row['idyoutube'].'"style="text-decoration: none">' .
            
    '<img width="120"  src="' $row['thumbnail_url'] . '" height="90" border="0">' 
            
    '<br



    PHP Code:
    CREATE TABLE `playlist` (
      `
    User_IDint(10unsigned NOT NULL default '0',
      `
    idyoutubevarchar(93character set latin1 NOT NULL default '0',
      `
    playlistnamevarchar(32character set latin1 NOT NULL default '',
      
    UNIQUE KEY `Index_1` (`User_ID`,`idyoutube`)
    ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;


    CREATE TABLE `youtubevideos2` (
      `
    IDint(11NOT NULL auto_increment,
      `
    authorvarchar(93NOT NULL default '0',
      `
    idyoutubevarchar(93NOT NULL default '0',
      `
    titlevarchar(93NOT NULL default '0',
      `
    length_secondsint(10unsigned NOT NULL default '0',
      `
    rating_avgint(10unsigned NOT NULL default '0',
      `
    rating_countint(10unsigned NOT NULL default '0',
      `
    descriptionvarchar(255NOT NULL default '0',
      `
    view_countint(10unsigned NOT NULL default '0',
      `
    upload_timeint(10unsigned NOT NULL default '0',
      `
    comment_countint(10unsigned NOT NULL default '0',
      `
    tagsvarchar(93NOT NULL default '0',
      `
    urlvarchar(93NOT NULL default '0',
      `
    thumbnail_urlvarchar(93NOT NULL default '0',
      `
    embed_idvarchar(93NOT NULL default '0',
      `
    embed_statusvarchar(93NOT NULL default '0',
      
    PRIMARY KEY  (`ID`)
    ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=237 
    Last edited by tony007; Oct 27th, 2007 at 12:17 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width