Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-10-2007, 10:05 AM
Vizionz Vizionz is offline
 
Join Date: Jul 2003
Location: Chicago
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default really need some help

i been trying to learn to code and took on a project but nevermind all that i am stumped so i will show you the code. i need to be able to grab song listings from a database table and show them in a neat table.

if i go here info.php?artist=Artistname
with the below code it will show all the albums in the database and info to go with it but what ever i have tried i cant get it to show a table with all the songs in the database to go with the album...
Code:
<?
connectdbase();

$artist=str_replace("|","&",$artist);
$artist=str_replace("***","\'",$artist);
$sql="SELECT ID,title,artist,albumyear,genre,album, picture from songlist WHERE artist='$artist' GROUP BY album ORDER BY album";
$result=mysql_query($sql);
while($data=mysql_fetch_object($result))
		
if($data->album!=''){
echo "<table class=alt2 border=0 width=100%><tr><td>";
echo "<table border=0 width=100% height=96><tr><td class=thead height=21><p align=left><font color=#c0c0c0>".$data->album." | Fan Rating: 9.4  | Rate this album</font></a></p></td></tr>";				
echo "<tr><td><table border=0 width=100%><tr><td><center><img src=pictures/".$data->picture."' border='1'width='130'height='130'></center></td><td width=30%><b>Artist</b>: ".$data->artist."</a><br><b>Album</b>: ".$data->album."<br><b>Release Date</b>: ".$data->albumyear."<br><b>Genre</b>: ".$data->genre."</td>";
echo "<td width=50%><p align=left>";
 <------ right here i want to display table---->
with the song listings for this current album
echo "</td>";
echo "</tr>";
echo "</td></tr></table>";											
echo "</td></tr></table>";
$artist=mysql_escape_string($data->artist);
$album=mysql_escape_string($data->album);

$sql2="SELECT title from songlist WHERE artist='$artist' AND album='$album'";
$result2=mysql_query($sql2);
$tracks=0;
while($data2=mysql_fetch_object($result2))
	{
	$tracks++;
	}

	if($tracks>0){
		echo "$tracks</td></tr>";
		} else {
		echo "none";
	}
echo "</td></tr>";
$count++;
}
?>

in the above code is what i have so far. and you can see a arrow and where i would like to throw in a table that grabs the songs for the album associated..
if i type ".$data->title." it will show the first track but no others. thats where i get stuck

the code below is standalone which will grab the songs for that artists if i call the page

info.php?artist=Artistname&album=albumname


Code:
<table>
		<tr align=center bgcolor="<? echo $tbl_hdr; ?>">
		<td>
		<font size=1 color="<? echo $text; ?>" face=tahoma>
		Num
		</td>
		<td>
		<font face=tahoma size=1 color="<? echo $text; ?>">
		TRACK NAME
		</td>

		<tr>
		<td>
		<font face=tahoma size=1 color="<? echo $highlight; ?>">
			<?
			$count=0;
			$artist=$data->artist;
			connectdbase();
			$query2 = "select ID,title,trackno from songlist WHERE album='$album' and artist='$artist' ORDER BY trackno";
			$result2 = mysql_query($query2);
			while($data2=mysql_fetch_object($result2))
			{
			$count++;
			if(($count % 2)==0){
				$bgcolor=$dark;
			} else {
				$bgcolor=$light;
			}
			echo "<tr bgcolor=$bgcolor><td><font size=2 face=tahoma color='$highlight'>";
			if($data2->trackno!='0'){
			echo $data2->trackno;
			} else {
			echo $count;
			}
			echo "</td/><td><font face=tahoma size=2 color='$text'>";
			echo $data2->title;
			echo "</td></tr>";
			}
			?>
		</td>
		</tr>
	</table>
by itself and it will show the songs in a nice little table. but figure one allows me to grab all the artists albums in one spot. and now i just need to throw the songs for the albums in there.
Reply With Quote
  #2  
Old 06-10-2007, 10:54 AM
Delphiprogrammi Delphiprogrammi is offline
 
Join Date: Feb 2004
Location: Landen(Belgium)
Posts: 1,335
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well,

this line

PHP Code:
connectdbase(); 
that looks like a function call but the function is never defined you are requird to either include the file where you defined that function or you must define the function within the same file but before you make the call.Before you can retrieve data from a MySQL database(or any databaseserver for that matter) you must be connected to it
Reply With Quote
  #3  
Old 06-10-2007, 10:56 AM
Vizionz Vizionz is offline
 
Join Date: Jul 2003
Location: Chicago
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
<?
session_start();

require "common.php";

?>
i'm getting the connection above code. and data shows. i just not getting the song listing like below.

1.track 1
2.track2
3.track3

all that i have been able to do is generate

TrackName

i need to grab the song listings and throw it in the top code. so every album thats in the database will generate the whole thing.

right now the top code. displays.

artist
genre
album
picture
total songs count
realease date

now that will show the stats for each album. i just havent been able to find away to throw all th songs for the album in there,
Reply With Quote
  #4  
Old 06-10-2007, 12:30 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

untested but the basic idea is
PHP Code:
<?
connectdbase();

$artist=str_replace("|","&",$artist);
$artist=str_replace("***","\'",$artist);
$sql="SELECT ID,title,artist,albumyear,genre,album, picture from songlist WHERE artist='$artist' GROUP BY album ORDER BY album";
$result=mysql_query($sql);
while($data=mysql_fetch_object($result))
        
if($data->album!=''){
echo "<table class=alt2 border=0 width=100%><tr><td>";
echo "<table border=0 width=100% height=96><tr><td class=thead height=21><p align=left><font color=#c0c0c0>".$data->album." | Fan Rating: 9.4  | Rate this album</font></a></p></td></tr>";                
echo "<tr><td><table border=0 width=100%><tr><td><center><img src=pictures/".$data->picture."' border='1'width='130'height='130'></center></td><td width=30%><b>Artist</b>: ".$data->artist."</a><br><b>Album</b>: ".$data->album."<br><b>Release Date</b>: ".$data->albumyear."<br><b>Genre</b>: ".$data->genre."</td>";
echo "<td width=50%><p align=left>";
 <------ right here i want to display table---->
with the song listings for this current album
echo "</td>";
echo "</tr>";
echo "</td></tr></table>";                                            
echo "</td></tr></table>";
$artist=mysql_escape_string($data->artist);
$album=mysql_escape_string($data->album);

$sql2="SELECT title from songlist WHERE artist='$artist' AND album='$album'";
$result2=mysql_query($sql2);
$tracks=0;
while($data2=mysql_fetch_object($result2))
    {
    $tracks++;
/*<table>
        <tr align=center bgcolor="<? echo $tbl_hdr; ?>">
        <td>
        <font size=1 color="<? echo $text; ?>" face=tahoma>
        Num
        </td>
        <td>
        <font face=tahoma size=1 color="<? echo $text; ?>">
        TRACK NAME
        </td>

        <tr>
        <td>
        <font face=tahoma size=1 color="<? echo $highlight; ?>">
            <?
            $count=0;
            $artist=$data->artist;
            connectdbase();
            $query2 = "select ID,title,trackno from songlist WHERE album='$album' and artist='$artist' ORDER BY trackno";
            $result2 = mysql_query($query2);
            while($data2=mysql_fetch_object($result2))
            {
            $count++;
            if(($count % 2)==0){
                $bgcolor=$dark;
            } else {
                $bgcolor=$light;
            }
            echo "<tr bgcolor=$bgcolor><td><font size=2 face=tahoma color='$highlight'>";
            if($data2->trackno!='0'){
            echo $data2->trackno;
            } else {
            echo $count;
            }
            echo "</td/><td><font face=tahoma size=2 color='$text'>";
            echo $data2->title;
            echo "</td></tr>";
            }
            ?>
        </td>
        </tr>
    </table>*/
    }

    if($tracks>0){
        echo "$tracks</td></tr>";
        } else {
        echo "none";
    }
echo "</td></tr>";
$count++;
}
?>
i commented it out to prevent the inevitable parse error.
Reply With Quote
  #5  
Old 06-10-2007, 12:46 PM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

that looks like wimpyplayer code. I did an integration with vbulletin on that sometime last year, but i didn't do it as a product, I hard-coded it into the system. Is it?
Reply With Quote
Reply


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. The time now is 02:23 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03937 seconds
  • Memory Usage 2,225KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete