steviez Posted January 28, 2007 Share Posted January 28, 2007 Hi,I run a music site and need to pull the file name of each song from the database when a user clicks on the track so the mp3 player can stream it.I thought i had it working until i tryed it! it will pull the correct track from the database when the user has just come on to the site, but if they try to play another song it just streams the same one.My code is as follows:[code]<?php$record_id = $_REQUEST['record_id'];mysql_select_db($database_db, $db);$query = "SELECT* FROM `audio`";$RS_record = mysql_query($query, $db) or die(mysql_error());$row_audio = mysql_fetch_assoc($RS_record);$audio = $row_audio['audio'];?>[/code] Maybe someone can tell me if this is rite.Where i want my track to be i place : [code]<?php echo $SITEURL ?><?php echo $AUDIO_URL ?><?php echo $audio; ?>[/code]Any help would be great!Thanks Quote Link to comment https://forums.phpfreaks.com/topic/36112-solved-help-with-code/ Share on other sites More sharing options...
HuggieBear Posted January 28, 2007 Share Posted January 28, 2007 You obviously have a column in your database that's a unique field, probably auto-incrementing. Is that $record_id?If it is, then you will need to include that in the WHERE clause of your query.[code=php:0]$query = "SELECT * FROM audio WHERE record_id = '$record_id'";[/code]That should give you the correct track to stream.This is obviously part of a much larger piece of code, so I can't comment on the bits you posted underneath the SQL code.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/36112-solved-help-with-code/#findComment-171460 Share on other sites More sharing options...
steviez Posted January 28, 2007 Author Share Posted January 28, 2007 Thats perfect works a treat! [b]thank you![/b] Quote Link to comment https://forums.phpfreaks.com/topic/36112-solved-help-with-code/#findComment-171476 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.