Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jun 27th, 2007, 11:15 AM   #1
Satans_Banjo
Newbie
 
Join Date: Oct 2006
Posts: 15
Rep Power: 0 Satans_Banjo is on a distinguished road
Trouble Retrieving Records From Database

Hi

I'm currently working on a website where people can submit links to music they have made. The submission form is now working (thanks to help from Styx) but now when I try to retrieve the contents of the database to display them on a page it doesn't seem to be able to. Here's the code I'm using to display them:

[php]
$username="*******";
$password="*******";
$database="*******";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die("Unable to connect to database");
$query="SELECT * FROM tunes";
$result=mysql_query($query);

$num=mysql_numrows($result);
mysql_close();

$i=0;

echo '<table border="1" align="center">
<tr>
<td colspan="4"><center>Database contents</center></td>
</tr>
<tr>
<td>Artist</td><td>Title</td><td>Genre</td><td>URL</td>';

while($i<$num)
{
$title=mysql_result($result,$i,"title");
$artist=mysql_result($result,$i,"artist");
$genre=mysql_result($result,$i,"genreID");
$url=mysql_result($result,$i,"url");
echo "<tr>
<td>$artist</td>
<td>$title</td>
<td>$genre</td>
<td>$url</td>
</tr>";
$i++;
}
echo "</table>";
[/php]

All the attribute names are correct and I'm doing things exactly the same as a tutorial said but this is how it's coming out:

http://www.electricjustice.com/viewtracks.php

As you can see, only the 'title' and 'url' attributes are being shown

Any advice?

Thanks

Banjo
Satans_Banjo is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing BLOBs in a database - problem jonyzz Other Programming Languages 8 Jan 31st, 2007 4:38 AM
.NET/ADO/MSACCESS database hbe02 Other Programming Languages 4 Sep 8th, 2006 2:57 PM
searching an access database? designXperts.net Visual Basic .NET 12 Nov 27th, 2005 5:03 PM
Using ODBC to connect to a remote database in a C program bigi C++ 1 Mar 8th, 2005 3:19 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:10 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC