Forum Moderators: coopster

Message Too Old, No Replies

creating links from database results

         

phprockz

4:14 pm on Feb 16, 2006 (gmt 0)

10+ Year Member



hello,
I did dedication page to my site as addon.I have problem with displaying songlink from database corresponding to songname and showing up that songlink to each record set. My script works like this user posts there wishes. users will select song name and fill all the required fileds and submit.On index page my script has to display from,to,message and songs field.Its displaying song name correctly but not songlink releated to songname.For this i wrote code like this
$song1 = $row_Recordset1['song'];

mysql_select_db($database_connBlog, $connBlog);
$query_song = "SELECT songlink FROM telugu_songs WHERE songname='$song1'";
$song = mysql_query($query_song, $connBlog) or die(mysql_error());
$row_song = mysql_fetch_assoc($song);
$totalRows_song = mysql_num_rows($song);

But its showing up same songlink to all records for download button instead of songlink of songname.
waiting for response.

[edited by: coopster at 7:06 pm (utc) on Feb. 16, 2006]
[edit reason] no personal urls please [/edit]

coopster

7:18 pm on Feb 16, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Please have a read through the forum Charter [webmasterworld.com] for some guidelines on posting.

In order to get the songlink to match up with the songname you simply print each out during each iteration of a loop. Here is an example of how that might be done, you'll obviously want to replace the 'print' statement with the correct HTML to be output:

$query = "SELECT songlink, songname FROM telugu_songs"; 
$rows = mysql_query($query);
$songList = ''; // initialize
while ($row = mysql_fetch_array($rows)) {
print "Link: {$row['songlink']}<br />Song: {$row['songname']}<br /><br />";
}

[edited by: jatar_k at 8:42 pm (utc) on Feb. 16, 2006]
[edit reason] you forgot the charter url [/edit]